-
-
Notifications
You must be signed in to change notification settings - Fork 199
Description
Hi guys!
I just finished hunting down a deep bug in Webpack / Encore. Here are the details:
-
A) When
mode: production
, Webpack sets theoptimization.namedChunks
option tofalse
. This is an internal key that's used in the generated files and when this is set to false, it uses incrementing integers. -
B) When you make certain changes (e.g. add a new entry), it may cause the chunk name for a specific chunk to change - e.g. 19 becomes 20. But this means that any files that depend on this module will change - a little
19
inside these files will be changed to20
, even if nothing else in that file changed. -
C) To make matters worse, this updated file contents does NOT cause the file's hash to change with versioning. The result is that the same filename is built, but with different contents.
The bug is described in Webpack here: webpack/webpack#8354 - and will likely be fixed in Webpack 5 - webpack/webpack#8374
I believe that this is only a problem if you use .enableSingleRuntimeChunk()
(which is the default in a new app) because this causes each file to be wrapped in code like this:
(window.webpackJsonp=window.webpackJsonp||[]).push([[6]
Where that [6]
is the chunk id that may change. If you do not use the single runtime chunk, the files are not wrapped with this.
I'll open a PR shortly to fix this.