-
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
Investigate compiling node_modules
code
#7064
Comments
Definitely interested in this. With more modules moving to ES6 and the need to support older browsers (Google bot 👀), this would be wonderful. Currently using old ES5 versions of the problematic modules. Not great. Even if it's not the default, an easy way to flag compilation of |
This probably won't be done for the initial v2 release. |
Any idea if this is on the roadmap for the near future? |
Any news on this? With the new theming capabilities it would be a great addition to extract graphql fragments into a theme. Or could this be achieved in any other way? |
@pgegenfurtner great point! So how we currently handle this now is we leverage the existing APIs we already offer. Longer term--we'd like to not have to do this (e.g. transpile node_modules) but for now, you can just use For an example, check out my blog-theme. There's some indirection there, so the general idea is as simple as: exports.onCreateWebpackConfig = function onCreateWebpackConfig({ actions, loaders }) {
actions.setWebpackConfig({
module: {
rules: [
{
test: 'gatsby-theme-your-theme',
use: [loaders.js()],
},
],
},
});
} Definitely your point is well taken that this can be improved. As far as fragments go--we currently (automatically) inspect fragments in any package named |
@DSchau thank you for your quick response! Definitely one of the best new gatsby features. |
@DSchau a new question raised as I'm working with this feature. Is it possible to override a query fragment from a theme? Currently my theme has a file with many fragments in it. A page I'm using the theme, may not have all fields of a fragment, so I would need to override it without the fields. I seem to can't default export a fragment, but I think I need to to override it? Exmple: Theme queryFragments.js:
Consuming page queryFragments.js:
When I run this, I always get an error |
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! Thanks for being a part of the Gatsby community! 💪💜 |
I hope this is the right place to ask this question, I wound up here from the polyfills section of the migration guide via #3870:
I'm confused by this because my understanding is that
If that's the case, what does the migration guide mean when it says that this is "not yet implemented for code imported from node_modules"? Shouldn't all code have access to the polyfills injected into the global scope? Is the issue that, because Gatsby uses Also, now that React requires |
There's a WIP PR that will resolve this: #14111 There's also a plugin that allows you to manually specify |
Could this be enabled via a CLI flag so people can opt-in or out themselves? |
We published node_module transpilation in |
Summary
Investigate:
Copy CRA's implementation for compiling
node_modules
with babel-preset-env which will fix problems like #3780Taken from #3870
The text was updated successfully, but these errors were encountered: