DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated

Varinder Sohal picture Varinder Sohal · Nov 13, 2020 · Viewed 11.4k times · Source

I am working on a react project and when I updated webpack 4.44.2 to 5.4.0 I am getting the following message:

[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)

I searched a lot but did not get an exact answer. So how can I solve ?

Answer

dhilt picture dhilt · Jan 16, 2021

Update 2021, Feb 25

Html-webpack-plugin v5 is released, just run

npm i -D html-webpack-plugin@latest

or

npm uninstall html-webpack-plugin

npm i -D html-webpack-plugin

Original answer

This is mostly related to html-webpack-plugin, and while its new version 5 (integrated with webpack v5) is still in beta, you should update it manually:

npm show html-webpack-plugin version 
4.5.1

npm show html-webpack-plugin@next version
5.0.0-beta.5

npm i -D html-webpack-plugin@next