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
Remove NamedModulesPlugin from production builds #1450
Conversation
Looks like Gatsby uses `webpack.NamedModulesPlugin()` in both production and development modes, diespite this comment in the development case: > Names module ids with their filepath. We use this in development > to make it easier to see what modules have hot reloaded, etc. as > the numerical IDs aren't useful. In production we use numerical module > ids to reduce filesize. Removing this plugin reduces the output filesize of my commons bundle from `268KB` to `213KB`
Deploy preview failed. Built with commit b87bfe7 https://app.netlify.com/sites/gatsbyjs/deploys/596372faa700c431db28c60d |
Deploy preview ready! Built with commit b87bfe7 |
Deploy preview ready! Built with commit b87bfe7 |
What's the gzip difference? |
gzipped: 63.0KB vs 60.5KB -- about 4% diff |
There's a community member that's working on a new webpack plugin for creating better hashed filenames. Let's just wait for that. The problem with the default numbered module ids is that they change on almost every build and invalidate JS bundles which isn't at all ideal. Since Gzipping takes care of almost all the size difference, I think we're fine. |
Thanks for looking into this! Appreciate your PRs here. |
Hello! Recently I have got an issue on my website related to
taken from gatsby website's static file When I am using CI system to deploy, it runs my build in random folder, so
It is happening in the following webpack internals // Execute the module function
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
Removing |
Another 2c: Webpack documentation says:
The purpose of plugin assumes it to be used only in development environment. @KyleAMathews would it convince you to change the decision regarding this PR? |
@just-boris oh hmmm I'm not actually sure we are using it. Or we are sort of? There's the "HashedChunkIdsPlugin" right below it in the prod config that a community member added. So I'm not sure why the NamedModulesPlugin is still there. Could you try removing it in a PR to see if all the example sites still build? |
There are two examples:
|
Looks like Gatsby uses
webpack.NamedModulesPlugin()
in both production and development modes, diespite this comment in the development case:Removing this plugin reduces the output filesize commons bundle from
268KB
to213KB
for a single component test site.