Resolve "Audit long-term cacheability of webpack assets"
What does this MR do?
- Upgrades
webpack
past v2.4 which provides support forwebpack.NamedChunksPlugin
. - Adds
webpack.NamedChunksPlugin
towebpack.config.js
with a basic rule to generate chunk names based on relative file paths. Prior to this, all chunks were just given sequential IDs, so adding a new chunk would often alter the digest string of many unrelated chunks. - Adds
NameAllModulesPlugin
to catch special modules not covered bywebpack.NamedModulesPlugin
as recommended in a recent webpack blogpost. Before this, certain special modules were still given sequential IDs which could change and disrupt compiled bundle digests. - Upgrades
webpack-bundle-analyzer
past v2.4.1 which fixes a bug relating to NamedChunksPlugin
The aim of all of this is to reduce the number of ways we might accidentally trigger a change in a bundle's digest string (which is what allows it to remain cacheable long-term). These changes have been tested to satisfy each of the following scenarios:
| actions in gitlab codebase | cache digests effected (before this MR) | cache digests effected (after this MR) | | ---- | ---- | ---- | ---- | | modify code in main.js | main | main | | import new script within main.js | main | main | | add new entry point and import a new library | common_vue, common_d3, and others | only new bundle | | add async chunk to bundle | all bundles | only async chunk | | modify code in async chunk | only async chunk | only async chunk |
Closes #32737 (closed)
Edited by Mike Greiling