-
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
feat(gatsby): enable babel-loader for all dependencies #14111
Conversation
@@ -292,7 +292,7 @@ module.exports = async ({ | |||
let js = (options = {}) => { | |||
return { | |||
test: /\.jsx?$/, | |||
exclude: vendorRegex, | |||
exclude: /core-js/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow core-js needs to be excluded because babel will try to polyfill core-js with core-js XD also mini-extra-css-plugin doesn't work well without this. This magically fixes it, i'm not 100% sure so the above comments are just speculation 😄 .
I'll add a comment when it's getting out of draft mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will try to polyfill core-js with core-js
😂
This will finally allow dependencies (themes and others) to have queries! Woohoo 🚀 |
Want to also post diff of bundle size from before and after? Curious how much this adds or removes |
Can also remove note in https://www.gatsbyjs.org/docs/browser-support/#polyfills |
I've added a list of changes that this PR creates. It only adds 12kb to gatsbyjs.org which is extremely low minified so I guess we should just get this in and reduce it again when using modern builds. Babel all the things! |
I've edited above comment with new elements! Lets get this in! ^^ |
💯yeah, let's do this! The extra build time is a bummer but so is sites not working on older browsers. Does this PR disable transpiling node_modules during development? That'd be something to consider as people are more sensitive to build times when trying to start the develop server vs. doing a production build (which probably is happening on a CI server somewhere) |
I've found a bug on develop where somehow react-hot-loader is causing issues. trying to find out why |
seems like I needed to add event-source-polyfill & webpack-hot-middleware/client as we don't want them to get polyfilled. As they act as HMR polyfills. If we don't exclude we get some core-js loops and errors. |
e943596
to
bd335a9
Compare
bd335a9
to
d8df2e0
Compare
I haven't tested the latest change, I'll do that tomorrow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ready to go now! Thank you @wardpeet ❤️
Published in |
That's great, thanks for this @wardpeet ! |
this is kinda of a breaking change for sites with custom babel configs ya'll |
@jquense yikes —- we’re sorry to hear that! Would you mind opening up an issue and showing us exactly how this is breaking? |
It wasn't a huge deal for us, but it's not obvious what was happening. There isn't a lot to how it breaks unfortunately. It's just not safe to apply any babel config to any code. For instance: |
@wardpeet the increased build times are a pretty big issue for us, as our build times were long enough as they were. They have gone from about 6 minutes all the way up to 11 minutes (and rebuilds are triggered quite regularly). As we are paying for compute time per minute spent building, this drives up the costs for CI builds to nearly double. While I understand why the changes in this PR were introduced, would it not be possible to have an option to turn this off (in |
Gatsby@2.11.0 Build failure gatsbyjs/gatsby#15190 (comment) > gatsby-plugin-netlify-cms runs an independent Webpack build within > Gatsby's Webpack build (insert "yo dawg" reference here) using a > modified version of the Gatsby Webpack config. Gatsby 2.11.0 no longer > excludes node_modules, which causes the plugin's Webpack build to attempt > processing the Netlify CMS modules with Babel. The modules are massive > and also prebuilt, so it will (and should) crash your system. > The PR I raised fix(gatsby-plugin-netlify-cms): exclude node_modules from cms builds gatsbyjs/gatsby#15191 > just adds that exclusion back in to the plugin's Webpack config. > Please don't override your node max file size limit to fix this! feat(gatsby): enable babel-loader for all dependencies gatsbyjs/gatsby#14111
Because of gatsbyjs#14111, we can remove the custom theme processing.
Description
I ran gatsby through babel-loader to make sure babel-preset-env can adds it's polyfills for all dependencies so we don't break on older browsers. This will also help us for modern builds so our modern build will have fewer polyfills than our classic one.
To give you an idea on how much slower it is. The first run on a big website takes about double so that's something to wonder about.
bundle info
http://wardpeet-filestorage.surge.sh/gatsby-store/pr-14111
Related Issues
#12409
#12399
#13427
#5553
#7064
#13241