DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.
See original GitHub issueconst 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)
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Related StackOverflow Question
Make sure you are using the
nextversion of html-webpack-plugin (i.e.html-webpack-plugin@next) as it has support for webpack 5.@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”,