-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Comments
For maintainers only:
|
webpack-5 bug |
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. |
Make sure you are using the |
@bebraw Thank you for solving the problem! npm i --save-dev html-webpack-plugin@next ,that will do 。 |
@livelyPeng please do spam, answer above |
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)The text was updated successfully, but these errors were encountered: