html-webpack-plugin: Webpack 5 "BREAKING CHANGE" warning
Expected behaviour
The excellent plugin should work with webpack 5 without deprecation notices
Current behaviour
94% sealing after seal(node:15584) [DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH] DeprecationWarning: MainTemplate.getAssetPath is deprecated (use Compilation.getAssetPath instead)
at D:\fun-project\node_modules\html-webpack-plugin\lib\child-compiler.js:163:41
at Array.map (<anonymous>)
at extractHelperFilesFromCompilation (D:\fun-project\node_modules\html-webpack-plugin\lib\child-compiler.js:162:45)
at D:\fun-project\node_modules\html-webpack-plugin\lib\child-compiler.js:113:13
at D:\fun-project\node_modules\webpack\lib\Compiler.js:486:11
at D:\fun-project\node_modules\webpack\lib\Compiler.js:981:17
at eval (eval at create (D:\fun-project\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:11:1)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
95% emitting emit HtmlWebpackPlugin(node:15584) [DEP_WEBPACK_MAIN_TEMPLATE_GET_PUBLIC_PATH] DeprecationWarning: MainTemplate.getPublicPath is deprecated (use Compilation.getAssetPath(compilation.outputOptions.publicPath, options) instead)
at HtmlWebpackPlugin.htmlWebpackPluginAssets (D:\fun-project\node_modules\html-webpack-plugin\index.js:532:56)
at D:\fun-project\node_modules\html-webpack-plugin\index.js:164:29
at Hook.eval [as callAsync] (eval at create (D:\fun-project\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:10:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (D:\fun-project\node_modules\webpack\node_modules\tapable\lib\Hook.js:18:14)
at Compiler.emitAssets (D:\fun-project\node_modules\webpack\lib\Compiler.js:729:19)
at D:\fun-project\node_modules\webpack\lib\Compiler.js:392:10
at processTicksAndRejections (internal/process/task_queues.js:79:11)
95% emitting emit(node:15584) [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 D:\fun-project\node_modules\html-webpack-plugin\index.js:273:49
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Seems like the first 2 warnings are covered by #1408
Environment
Node.js v12.18.2
win32 10.0.18362
npm 6.14.5
webpack@5.0.0-beta.28
html-webpack-plugin@4.3.0
Config
module.exports = {
context: path.resolve(__dirname, 'src'),
mode: 'development',
entry: '/scripts/app.js',
output: {
path: __dirname + '/dist',
filename: 'index_bundle.js'
},
plugins: [
new HtmlWebpackPlugin({
template: 'public/index.html',
}),
]
}
Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>fun app</title>
</head>
<body>
<p>does it matter?</p>
</body>
</html>
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 16
- Comments: 22 (8 by maintainers)
Commits related to this issue
- 종속성 업데이트 한가지 이슈가 남음 (node:17981) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated. BREAKING CHANGE: No more changes ... — committed to ybbarng/set by ybbarng 4 years ago
- 종속성 업데이트 한가지 이슈가 남음 (node:17981) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated. BREAKING CHANGE: No more changes ... — committed to ybbarng/set by ybbarng 4 years ago
- Move to webpack 5 * Minifier WA can be now dropped since the pulled cssnano version includes the fix * Adjust to new copy-webpack-plugin API. * Adjust included node modules plugin needs to webpack 5 ... — committed to KKoukiou/cockpit by KKoukiou 3 years ago
- Move to webpack 5 * Minifier WA can be now dropped since the pulled cssnano version includes the fix * Adjust to new copy-webpack-plugin API. * Adjust included node modules plugin needs to webpack... — committed to cockpit-project/cockpit by KKoukiou 3 years ago
Looks like that fixes it @jantimon 👍
Previously:
Then updated with
yarn add --dev html-webpack-plugin@5.0.0-alpha.3Result now:
webpack5.0.0,html-webpack-plugin4.5.0:what progress about the compatibility of webpack@5, webpack@5 have been released
2020-10-10There are lots of plugins based onhtml-webpack-plugin. 👍Sorry I missed some parts in the last release can you please try once again with html-webpack-plugin@5.0.0-alpha.3
@rnnyrk the tests are green again and there is only one last topic in https://github.com/jantimon/html-webpack-plugin/issues/1527 to be solved - after that I expect no further breaking changes and would release a beta version…
if there won’t be any bugs reported with that release I’ll release it as a stable version
I hope that’s fine
@jantimon FYI, having the same issue exactly with 4.4.1 +
webpack@5.0.0-beta.29.I’m still seeing it after updating to
5.0.0-alpha.2@jantimon I’ve tested 4.4.1 (with
webpack@5.0.0-beta.29andwebpack-cli@4.0.0-beta.8), and most deprecation warnings are gone. There’s one left:I ran webpack-cli directly with
--trace-deprecation, so you can see it’s being logged at line 278:Changing the hook would be a breaking change I guess - I’ll ask the webpack core team on guidance which stage to use:
https://webpack.js.org/api/compilation-hooks/#processassets
I am not sure if this might cause issues with chunk hashes (as they are not known at this time)