markshapiro / webpack-merge-and-include-globally

Merge multiple files (js, css..) and include by running them "as is". Supports minify by custom transform and wildcard paths.
MIT License
102 stars 27 forks source link

Webpack 5 Deprecation: Compilation.assets will be frozen in future #47

Closed kelunik closed 3 years ago

kelunik commented 4 years ago

While using webpack 5, the following deprecation warning appears in the build output:

MergeIntoFile(node:52697) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.
BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation.
        Do changes to assets earlier, e. g. in Compilation.hooks.processAssets.
        Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.
kelunik commented 4 years ago

Nevermind, this seems to be the html-webpack-plugin.

kelunik commented 4 years ago

Actually, both plugins have this issue, but it doesn't always appear as warning.

MergeIntoFile(node:272390) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.
BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation.
        Do changes to assets earlier, e. g. in Compilation.hooks.processAssets.
        Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.
    at /home/kelunik/Git/project-xy/node_modules/webpack-merge-and-include-globally/index.node6-compatible.js:139:49
    at Array.forEach (<anonymous>)
    at /home/kelunik/Git/project-xy/node_modules/webpack-merge-and-include-globally/index.node6-compatible.js:110:35
    at Generator.next (<anonymous>)
    at step (/home/kelunik/Git/project-xy/node_modules/webpack-merge-and-include-globally/index.node6-compatible.js:3:191)
    at /home/kelunik/Git/project-xy/node_modules/webpack-merge-and-include-globally/index.node6-compatible.js:3:361
markshapiro commented 3 years ago

@kelunik I just published fix by @igk1972

markshapiro commented 3 years ago

@igk1972 big thanks for fix!

kelunik commented 3 years ago

@markshapiro Thanks! I'll need to give webpack 5 another try, it was quite slow for me. I haven't tried the fix, yet, but I have added a comment on the merged PR. I guess it needs to be thisCompilation instead of compilation.

kelunik commented 3 years ago

I'll close this and re-open, in case there are any issues.