關於 vue 項目 run dev 的時候,控制台警告:
No parser and no filepath given, using 'babylon' the parser now but this will throw an error in the future. Please specify a parser or a file path so one can be inferred.
這個一般是配置問題,是vue-loader的問題。
不過有的說是 安裝 prettier 依賴,來控制代碼格式,好像沒用。
其實有個簡單的方法就是修改一下js文件:
去文件夾:
node_modules\vue-loader\lib\template-compiler\index.js
下進行修改:
if (!isProduction) {
code = prettier.format(code, { semi: false})
}
修改成:
if (!isProduction) {
code = prettier.format(code, { semi: false, parser: 'babylon' })
}
OK,去重新run 一下
