我如何在编译时解决弃用警告 [英] how do i solve the deprecation warning while compiling

查看:23
本文介绍了我如何在编译时解决弃用警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个警告是什么意思以及如何解决它.这是我应该担心的事情.我试过阅读 webpack 的文档.

what does this warning mean and how to resolve it. Is it something I should worry about. I've tried reading the webpack's documentation.

推荐答案

您实际上不必担心弃用警告,有时某些或其他库会适应新事物并弃用以前的(它将工作正常)出于各种原因,如安全漏洞、性能或更好的东西.您的警告似乎与 html-webpack-plugin 相关

You don't actually have to worry about deprecation warnings, from time to time some or the other library will adapt to something new and deprecate the previous (it will work fine though) for various reasons like security loopholes, performance or something better. Your warning appears to be related to html-webpack-plugin

在您的 webpack.config 中添加如下所示的 stats 属性以抑制警告

In your webpack.config add the stats property like below to suppress warnings

module.exports = {
  entry: './index.js',
  stats: { warnings:false }
}

另外,尝试卸载你的 html-webpack-plugin 并安装最新的 ||升级以修复它

Also, try uninstalling your html-webpack-plugin and install latest || upgrade to fix it

node --trace-deprecation ./node_modules/.bin/the_library_name_here 将列出所有的弃用

您可以执行 npm outdated 来检查最新版本.或者干脆 npm update --force 也可以更新.

You could do npm outdated to check the latest versions. or simply npm update --force as well to update.

这篇关于我如何在编译时解决弃用警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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