去除npm run dev日志warn记录

Posted qiqi715

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了去除npm run dev日志warn记录相关的知识,希望对你有一定的参考价值。

babel的一些eslint方法废除了

问题

 ...ode_moduleswebpackhotdev-server.jsThe babel/generator-star-spacing rule is deprecated. Please use the built in generator-star-spacing rule instead.
The babel/array-bracket-spacing rule is deprecated. Please use the built in array-bracket-spacing rule instead.
The babel/object-shorthand rule is deprecated. Please use the built in object-shorthand rule instead.
The babel/arrow-parens rule is deprecated. Please use the built in arrow-parens rule instead.
The babel/no-await-in-loop rule is deprecated. Please use the built in no-await-in-loop rule instead.    

解决方案

.eslintrc文件中或者在该文件extends的依赖中找到rules,删除掉

相关文档

https://github.com/babel/eslint-plugin-babel 中的Deprecated章节说说明

webpack的loaderUtils.parseQuery()被废弃了

问题

DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56

解决方案

webpack.config.js全局变量process添加traceDeprecation属性,并设置成true,

process.traceDeprecation = true

重新npm run dev。会打印详情信息。

DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
    at Object.parseQuery (xxxx
ode_modulesfile-loader
ode_modulesloader-utilsindex.js:78:3)
    at Object.module.exports (xxxx
ode_modulesfile-loaderindex.js:11:26)

通过详细信息定位到是file-loader还在使用旧的方法,升级file-loader即可。

相关文档

https://github.com/webpack/loader-utils/issues/56

postcss相关

问题

app.cssNode#before is deprecated. Use Node#raws.before

解决方案

升级到postcss到6.0以上。实际上package.json并没有直接引用postcss,升级postcss-loader就好。

相关文档

https://github.com/postcss/autoprefixer/issues/905

以上是关于去除npm run dev日志warn记录的主要内容,如果未能解决你的问题,请参考以下文章

可以在 npm run dev - ubuntu 中找到此运行的完整日志

webpack4学习记录运行npm run dev 报错npm ERR! Failed at the webpacktest@1.0.0 dev script.

webpack4学习记录运行npm run dev 报错npm ERR! Failed at the webpacktest@1.0.0 dev script.

webpack4学习记录运行npm run dev 报错npm ERR! Failed at the webpacktest@1.0.0 dev script.

npm WARN lifecycle yarn@1.22.19~preinstall: cannot run in wd %s %s

iview npm run dev运行不了