webpack-theme-color-replacer icon indicating copy to clipboard operation
webpack-theme-color-replacer copied to clipboard

webpack 5 中的弃用警告

Open NHZEX opened this issue 3 years ago • 3 comments

(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

NHZEX avatar Jan 16 '22 15:01 NHZEX

之前也发现了,暂时没找到好办法

hzsrc avatar Mar 25 '22 12:03 hzsrc

有什么好的建议吗?

hzsrc avatar Apr 30 '22 16:04 hzsrc

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

NHZEX avatar Apr 30 '22 16:04 NHZEX

当webpack 版本大于等于 5时,使用 webpack5 api 以适配 webpack5 的支持,经测试正常(webpack version: 5.75.0) https://github.com/hzsrc/webpack-theme-color-replacer/pull/114

linpengteng avatar Dec 08 '22 09:12 linpengteng

感谢 @linpengteng !问题解决了。使用1.4.4版本

hzsrc avatar Dec 16 '22 13:12 hzsrc