Skip to content

Commit

Permalink
chore(webpack): deterministic output when changing config
Browse files Browse the repository at this point in the history
found through much testing, setting chunkIds and moduleIds to
"deterministic" (which is the default in production) results in
undeterministic behavior when making changes to the webpack config which
don't result in any changes to the inherent content of processed files

this seems to be because "deterministic" uses metadata about all
configured module loaders there are in the webpack config when
calculating the hash, so if you remove a loader which isn't doing
anything, that change still results in a change to the module and chunk
ids

instead, using either "named" or "natural" ensures that such changes
don't result in any changes to the webpack output

this allows easy verification that modifications to the webpack config
haven't changed any output with a simple diff
  • Loading branch information
LeoMcA committed May 8, 2024
1 parent 8ee8605 commit 4a5cf81
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ function config(webpackEnv) {
level: "none",
},
optimization: {
chunkIds: isEnvProduction ? "natural" : "named",
moduleIds: isEnvProduction ? "natural" : "named",
minimize: isEnvProduction,
minimizer: [
// This is only used in production mode
Expand Down

0 comments on commit 4a5cf81

Please sign in to comment.