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

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

Closed
parlay96 opened this issue Nov 16, 2020 · 6 comments

Comments

@parlay96
Copy link

const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const utils = require('./build/utils')
module.exports = {
entry: path.resolve(__dirname, 'src/index.tsx'),
resolve: {
extensions: [".js", ".ts", ".jsx", ".tsx"],
alias: {
"@": path.join(__dirname, "src")
}
},
optimization: {
moduleIds: 'hashed' // webapck5替代 4中的 new webpack.NamedModulesPlugin(),
},
module:{
rules: [
{
test: /.(js|jsx|ts|tsx)$/,
use: ["babel-loader", "ts-loader"],
exclude: /node_modules/
},
{
test: /.scss$/,
exclude: /node_modules/,
use: [
'style-loader',
"css-loader",
"sass-loader"
]
},
{
test: /.css$/,
use: ['style-loader','css-loader']
},
{
test: /.(png|svg|jpg|gif)$/,
use: [
'file-loader'
]
}
]
},
plugins: [
// new CleanWebpackPlugin(),
// new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
templateParameters: {
PUBLIC_URL: 'static',
title: 'react app template'
},
filename: 'index.html',
template: utils.resolve('public/index.html'),
inject: true
})
]
}

Something went wrong:
[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)

@webpack-bot
Copy link
Contributor

For maintainers only:

  • webpack-4
  • webpack-5
  • bug
  • critical-bug
  • enhancement
  • documentation
  • performance
  • dependencies
  • question

@parlay96
Copy link
Author

webpack-5 bug

@csvan
Copy link

csvan commented Nov 16, 2020

You already opened this: #11993

Also, this is almost certainly a problem with a specific loader/plugin, you should figure out which one and report it there.

@bebraw
Copy link
Contributor

bebraw commented Nov 16, 2020

Make sure you are using the next version of html-webpack-plugin (i.e. html-webpack-plugin@next) as it has support for webpack 5.

@parlay96
Copy link
Author

@bebraw Thank you for solving the problem! npm i --save-dev html-webpack-plugin@next ,that will do 。
"html-webpack-plugin": "^5.0.0-alpha.14",

@alexander-akait
Copy link
Member

@livelyPeng please do spam, answer above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants