Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated. #1523

Closed
MaxmaxmaximusAWS opened this issue Oct 5, 2020 · 29 comments

Comments

@MaxmaxmaximusAWS
Copy link

MaxmaxmaximusAWS commented Oct 5, 2020

"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)
@deleonio
Copy link

deleonio commented Oct 6, 2020

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

@ronanyeah
Copy link

#1501

@jantimon
Copy link
Owner

Can you please see if this is fixed with html-webpack-plugin@5.0.0-alpha.2 ?
Please see also #1527

@grgur
Copy link

grgur commented Oct 16, 2020

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

@jantimon
Copy link
Owner

Thanks for testing 👍

@sadeqsheikhi
Copy link

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

@yumindeckard
Copy link

Same here.

@jantimon
Copy link
Owner

Can you please try html-webpack-plugin@5.0.0-alpha.6?

@jantimon jantimon reopened this Oct 17, 2020
@bigskillet
Copy link

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

@sadeqsheikhi
Copy link

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

same here, no warning with alpha 6

@jantimon
Copy link
Owner

thanks for the testing feedback 👍

lokshunhung added a commit to pinnacle0/frontend-libraries that referenced this issue Oct 27, 2020
lokshunhung added a commit to pinnacle0/frontend-libraries that referenced this issue Oct 27, 2020
@borm
Copy link

borm commented Nov 1, 2020

 [DEP_WEBPACK_SINGLE_ENTRY_PLUGIN] DeprecationWarning: SingleEntryPlugin was renamed to EntryPlugin

@jantimon
Copy link
Owner

jantimon commented Nov 1, 2020


 [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

@Yijx
Copy link

Yijx commented Nov 2, 2020


 [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

@uniquemo
Copy link

uniquemo commented Nov 2, 2020


 [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

@Justin-YAA
Copy link


 [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

@jantimon
Copy link
Owner

jantimon commented Nov 2, 2020

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

@realamirhe
Copy link

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"
}

@jantimon
Copy link
Owner

jantimon commented Nov 5, 2020

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

https://unpkg.com/html-webpack-plugin@5.0.0-alpha.10/lib/child-compiler.js

@realamirhe
Copy link

@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 😢 )

@realamirhe
Copy link

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

thank you 🙏

@surielmx
Copy link

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 ?

@jantimon
Copy link
Owner

jantimon commented Nov 13, 2020

@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

@mauriziocescon
Copy link

mauriziocescon commented Nov 13, 2020

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

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

@mauriziocescon
Copy link

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

@jantimon
Copy link
Owner

jantimon commented Nov 13, 2020

@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

@surielmx
Copy link

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

@mauriziocescon
Copy link

mauriziocescon commented Nov 13, 2020

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',
}),

@jantimon
Copy link
Owner

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.

Repository owner locked as resolved and limited conversation to collaborators Nov 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests