創(chuàng)建好項(xiàng)目后 發(fā)現(xiàn) console.log 報(bào)錯(cuò) 還有這種奇葩報(bào)錯(cuò)???
找了好半天才知道是 eslint 搞得鬼
解決辦法
-
修改package.json中的eslintConfig:{} 中的 “rules”:{},增加一行代碼: "no-console":"off"
image.png 建立一個(gè).eslintrc.js文件,內(nèi)容如下:
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
},
parserOptions: {
parser: 'babel-eslint'
}
}