brotli-webpack-plugin icon indicating copy to clipboard operation
brotli-webpack-plugin copied to clipboard

Fix: Use safe compilation hooks to prevent deprecation warning

Open hmak-dev opened this issue 3 years ago • 3 comments

I was working on improving my Webpack build performance and faced this warning, just took a look at brotli-webpack-plugin source codes and had it fixed by putting it in the right compilation stage.

95% emitting emit BrotliPlugin(node:438254) [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_*.
(Use `node --trace-deprecation ...` to show where the warning was created)

Also, kept old codes in case someone uses this plugin with older versions of Webpack to make sure this breaks nothing.

hmak-dev avatar Jul 13 '21 06:07 hmak-dev

Guys, I need this fix. When you will update the plugin? Many thanks!

siarhei-novik avatar Dec 24 '21 11:12 siarhei-novik

I'm also waiting for this fix ... any chance you could review it @mynameiswhm ?

mo avatar Jun 12 '22 13:06 mo

Actually, nevermind... I noticed compression-webpack-plugin has brotli support now so I just switched to that.

mo avatar Jun 12 '22 14:06 mo