-
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
Allow to pass functions in gatsby-config.js for browser and SSR #14199
Comments
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contributefor more information about opening PRs, triaging issues, and contributing! Thanks for being a part of the Gatsby community! 💪💜 |
This is a hard nut to crack at the moment. We have to send this function over to webpack which is a bit hard. We can stringify it but a better ways it to compile it to an AST and reconstruct it on gatsby-browser. A workaround for this is to save this content to disk and import it inside gatsby-browser. |
I running into this issue as well. I'm using a gatsby theme and I have multiple sites. Each one needs to pass an object that is used for some central configuration, and that object can have functions (it's for mocking API endpoints client-side). In the theme's |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks again for being part of the Gatsby community! |
Summary
Currently, options for the plugins in
gatsby-config.js
are stringified for the browser and SSR as mentioned in #13440 However, in some plugins functions are the part of the configurations. So preserving functions would be a great addition for the config file.'Basic example
Imagine you have a plugin which calls your provided callback.
Motivation
In some plugins, you need to provide some kind of callback. I faced this issue with
gatsby-plugin-web-font-loader
where I needed to provide a callback for font load.The text was updated successfully, but these errors were encountered: