-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass function in plugin options to gatsby-browser.js #3834
Comments
Hmm wait, |
What are you trying to do exactly? Gatsby has a build step where pages are generated, where the code from |
I was trying to write a i18n plugin, where user would define a function in the plugin config. This function would be used throughout the plugin code, to determine the language from
But it's not possible, because After some thought, I used a different approach. By creating a custom graphql |
@HriBB Thanks for the update, there's now a note in the docs about plugin config stringification. |
I'm not entirely sure about this, I'm aware of the origin #3987 yet this PR I made proofs the opposite #12060 Only thing I can think of right now that browser APIs get stringified, couldn't verify this so far, this #3834 is suggesting they get stringified and it's the reason the note was added to the docs in the first place.. Couldn't just leave my confusion alone and thought doing it in a PR might be useful if it's actually not valid anymore so it can be merged directly, otherwise feel free to reject it of course 👍
How can we pass functions in plugin options?
app/gatsby-config.js
gatsby-plugin-i18next/gatsby-node.js
Output of console.log
As you can see,
getLanguage
function is not available in plugin options. Am I missing something obvious here?The text was updated successfully, but these errors were encountered: