Html-webpack-plugin: [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.

Created on 5 Oct 2020  路  29Comments  路  Source: jantimon/html-webpack-plugin

"webpack": "^5.0.0-rc.3",

> node --trace-deprecation scripts/build.js

(node:3436) [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 C:\localhost\maxmaxmaximus\node_modules\html-webpack-plugin\index.js:280:49
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Most helpful comment

Alpha.6 seems to have removed the warning for me.

All 29 comments

What's the problem?!

I support the @leanup/cli and prepare the webpack upgrade.

Reproduce (latest)

npm i @leanup/cli @leanup/cli-preact
npx lean create -o
npm start

Reproduce (webpack v5)

npm i @leanup/cli@webpack @leanup/cli-preact@webpack
npx lean create -o
npm start

image

Can you please see if this is fixed with [email protected] ?
Please see also #1527

It looks good in the latest alpha.3. Thanks @jantimon

Thanks for testing 馃憤

[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_*.

Same here.

Can you please try [email protected]?

Alpha.6 seems to have removed the warning for me.

Alpha.6 seems to have removed the warning for me.

same here, no warning with alpha 6

thanks for the testing feedback 馃憤

 [DEP_WEBPACK_SINGLE_ENTRY_PLUGIN] DeprecationWarning: SingleEntryPlugin was renamed to EntryPlugin
 [DEP_WEBPACK_SINGLE_ENTRY_PLUGIN] DeprecationWarning: SingleEntryPlugin was renamed to EntryPlugin

Which version did you use?

Can you please try https://www.npmjs.com/package/html-webpack-plugin/v/5.0.0-alpha.9

 [DEP_WEBPACK_SINGLE_ENTRY_PLUGIN] DeprecationWarning: SingleEntryPlugin was renamed to EntryPlugin

Which version did you use?

Can you please try https://www.npmjs.com/package/html-webpack-plugin/v/5.0.0-alpha.9

5.0.0-alpha.7 is Ok, no warning. But 5.0.0-alpha.9 has this warning.
image

 [DEP_WEBPACK_SINGLE_ENTRY_PLUGIN] DeprecationWarning: SingleEntryPlugin was renamed to EntryPlugin

Which version did you use?
Can you please try https://www.npmjs.com/package/html-webpack-plugin/v/5.0.0-alpha.9

5.0.0-alpha.7 is Ok, no warning. But 5.0.0-alpha.9 has this warning.
image

I encounter the same problem~ also version 5.0.0-alpha.9

 [DEP_WEBPACK_SINGLE_ENTRY_PLUGIN] DeprecationWarning: SingleEntryPlugin was renamed to EntryPlugin

Which version did you use?

Can you please try https://www.npmjs.com/package/html-webpack-plugin/v/5.0.0-alpha.9

Same here, having the same warning with 5.0.0-alpha.9
image

Thanks for your feedback - switched to EntryPlugin for html-webpack-plugin/v/5.0.0-alpha.10

thanks for your works, but still have depreciation warnings with the latest versions

[DEP_WEBPACK_SINGLE_ENTRY_PLUGIN] DeprecationWarning: SingleEntryPlugin was renamed to EntryPlugin
[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_*.

installed packages

{
  "html-webpack-plugin": "^5.0.0-alpha.10",
  "webpack": "^5.4.0"
}

@amirHossein-Ebrahimi it looks like you using the wrong html-webpack-plugin version - alpha 10 has no SingleEntryPlugin but only EntryPlugin:

https://unpkg.com/[email protected]/lib/child-compiler.js

@jantimon yarn.lock is updated to the specified version ^5.0.0-alpha.10.
I'm going to test it (and install all packages again :cry: )

@jantimon you were right in the SingleEntryPlugin case it is not a case with html-webpack-plugin

thank you :pray:

Same issue, but...

Before update to 5.0.0-alpha.14
Screen Shot 2020-11-12 at 21 42 45

After update to 5.0.0-alpha.14
Screen Shot 2020-11-12 at 21 31 46

What I using...
code

It's related to html-webpack-plugin ?

@surielmx it's hard to tell as you have sooo many plugins and npm packages which could also cause this issue - can you try to remove all which are unrelated for the html generation and try again e.g. 'webpack-merge', 'babel', 'eslint', 'file-loader', 'open'....

You can also try: node --trace-deprecation node_modules/.bin/webpack to get more information on the deprecations

@surielmx I guess it might be related to the output. Try something like:

output: {
   path: path.resolve(__dirname, '../dist'),
   filename: '[name].[fullhash].js',
},

Hi @jantimon!

I have issues as well (webpack 5). Here is my toy-app (dev branch) with "html-webpack-plugin": "5.0.0-alpha.14". When I build (npm run build) I get the following error:

ERROR in Conflict: Multiple assets emit different content to the same filename index.html

Any idea what's going wrong?

As you can see, I have many plugins... but I think It's coming from HtmlWebpackPlugin cause in toy-app (master) with "html-webpack-plugin": "4.5.0" I get the warning mentioned by the others above (no errors).

With 4.5.0 the build script is fine (just the deprecation warning), but when I try to serve the app with webpack serve and modify the files I see index.html is empty... so no resources added. In other words, webpack serve is useless for development.

Screenshot 2020-11-13 at 18 46 25

@mauriziocescon no you are using the CopyWebpackPlugin to generate another index.html

Webpack doesn't why you want to generate two files with the same filename and therefore it shows this error

Thank you @mauriziocescon, filename: '[name].[fullhash].js' solves the problem.

Great, thanks a lot @jantimon, it works fine! Indeed, you are right... I created the config some time ago with webpack 4.
It wasn't a problem, but it doesn't make any sense copying index.

Thanks!

new CopyPlugin({
  patterns: [
    // {from: 'src/index.html'}, DO NOT COPY index 
    {from: 'src/assets/i18n', to: 'assets/i18n'},
    {from: 'src/assets/imgs', to: 'assets/imgs'},
  ],
}),

new HtmlWebpackPlugin({
   template: 'src/index.html',
   inject: 'body',
}),

This bug seems to be resolved - any other bugs are probably caused by other plugins.
I'll lock this issue for now - please open a new issue if you find new bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

klinki picture klinki  路  3Comments

laruiss picture laruiss  路  3Comments

rokoroku picture rokoroku  路  3Comments

amorphius picture amorphius  路  3Comments

MatthewKosloski picture MatthewKosloski  路  3Comments