webpack-theme-color-replacer
webpack-theme-color-replacer copied to clipboard
webpack 5 中的弃用警告
(node:29296) [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 Handler.handle (F:\Code\admin-web\node_modules\webpack-theme-color-replacer\src\Handler.js:24:40)
at F:\Code\admin-web\node_modules\webpack-theme-color-replacer\src\index.js:22:26
at Hook.eval [as callAsync] (eval at create (F:\Code\admin-web\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:14:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (F:\Code\admin-web\node_modules\tapable\lib\Hook.js:18:14)
at Compiler.emitAssets (F:\Code\admin-web\node_modules\webpack\lib\Compiler.js:873:19)
at F:\Code\admin-web\node_modules\webpack\lib\Watching.js:181:21
之前也发现了,暂时没找到好办法
有什么好的建议吗?
DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.
平时写后端多,这问题也啥好主意,参考下同类插件如何解决?
- https://github.com/jantimon/html-webpack-plugin/issues/1527
- https://github.com/webpack/webpack/issues/11425
当webpack 版本大于等于 5时,使用 webpack5 api 以适配 webpack5 的支持,经测试正常(webpack version: 5.75.0) https://github.com/hzsrc/webpack-theme-color-replacer/pull/114
感谢 @linpengteng !问题解决了。使用1.4.4版本