去除npm run dev日志warn記錄


一 babel的一些eslint方法廢除了

問題

 ...ode_modules\webpack\hot\dev-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\node_modules\file-loader\node_modules\loader-utils\index.js:78:3)
    at Object.module.exports (xxxx\node_modules\file-loader\index.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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM