DeprecationWarning: Compilation.assets 将来会被冻结,所有修改都被弃用 [英] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated

查看:12
本文介绍了DeprecationWarning: Compilation.assets 将来会被冻结,所有修改都被弃用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个 React 项目,当我将 webpack 4.44.2 更新到 5.4.0 时,我收到以下消息:

I am working on a react project and when I updated webpack 4.44.2 to 5.4.0 I am getting the following message:

[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)

我搜索了很多,但没有得到确切的答案.那我该如何解决?

I searched a lot but did not get an exact answer. So how can I solve ?

推荐答案

2021 年 2 月 25 日更新

Html-webpack-plugin v5 发布,直接运行

Html-webpack-plugin v5 is released, just run

npm i -D html-webpack-plugin@latest

npm uninstall html-webpack-plugin

npm i -D html-webpack-plugin


原始答案

这主要与 html-webpack-plugin 相关,虽然它的新版本 5(与 webpack v5 集成)仍处于测试阶段,您应该手动更新它:

This is mostly related to html-webpack-plugin, and while its new version 5 (integrated with webpack v5) is still in beta, you should update it manually:

npm show html-webpack-plugin version 
4.5.1

npm show html-webpack-plugin@next version
5.0.0-beta.5

npm i -D html-webpack-plugin@next

这篇关于DeprecationWarning: Compilation.assets 将来会被冻结,所有修改都被弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆