process.traceDeprecation 在 webpack.config 中不起作用 [英] process.traceDeprecation not working in webpack.config
问题描述
当我编译我的 JS 文件时,有一条消息在我的命令行中注销,内容为:
There's a message that logged out in my command line when I compiled my JS files that says:
(node:3276) DeprecationWarning: loaderUtils.parseQuery() 收到一个问题的非字符串值,请参阅https://github.com/webpack/loader-utils/issues/56parseQuery() 将是在 loader-utils 的下一个主要版本中替换为 getOptions().
(node:3276) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which oblematic, see https://github.com/webpack/loader-utils/issues/56 parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
所以我按照他们的建议添加了 process.traceDeprecation = true
,但它抛出了一个错误.我应该如何在我的 webpack.config.js
中正确添加它?
So I added the process.traceDeprecation = true
as they advised, but it threw an error. How should I add it properly in my webpack.config.js
?
推荐答案
process.traceDeprecation = true;
是在 Node.js 中启用弃用堆栈跟踪的语句.这是一个常规语句,就像分配一个常规变量一样.您可能将它添加到配置对象中,该对象抛出错误,因为它不是有效的 JavaScript.只需将它作为 webpack.config.js
的第一行,它看起来像这样:
process.traceDeprecation = true;
is a statement that enables the deprecation stack traces in Node.js. It is a regular statement like assigning a regular variable. You probably added it to the configuration object which throws an error as it's not valid JavaScript. Simply put it as the first line in your webpack.config.js
, so it looks like this:
process.traceDeprecation = true;
module.exports = {
// Your config
};
如果您正在寻找解决警告的方法,您应该查看 如何解决 Webpack 2 loaderUtils.parseQuery() 警告?.
If you're looking for a way to resolve the warning, you should have a look at How to resolve the Webpack 2 loaderUtils.parseQuery() Warning?.
这篇关于process.traceDeprecation 在 webpack.config 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!