Module build failed: Module failed because of a eslint warning
程序员文章站
2023-08-18 08:08:14
eslint 设置 warning 级别,在 开发编译失败的原因,报错如下: Module build failed: Module failed because of a eslint warning的原因,为自己当时即使是eslint 设置 warning 规则,在热更新都会报错,无法编译通过的 ......
eslint 设置 warning 级别,在 开发编译失败的原因,报错如下:
f:\vue-mobile-skeleton>npm run dev
> byhealth@1.0.0 dev f:\vue-mobile-skeleton
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
94% asset optimization
error failed to compile with 1 errors 22:51:17
error in ./src/app.vue
module build failed: module failed because of a eslint warning.
⚠ http://eslint.org/docs/rules/no-unused-vars 'o' is assigned a value but never used
src\app.vue:60:7
const o = 90;
^
✘ 1 problem (0 errors, 1 warning)
warnings:
1 http://eslint.org/docs/rules/no-unused-vars
@ ./src/main.js 12:0-28
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
module build failed: module failed because of a eslint warning的原因,为自己当时即使是eslint 设置 warning 规则,在热更新都会报错,无法编译通过的!
解决:
1:把这个没有使用变量,删除
2:使用 注释方式不进行检测 => // eslint-disable-next-line
3:把 eslint-laoder 的选项设置 fasle 即可;
// 目录:/build/webpack.base.conf.js const createlintingrule = () => ({ test: /\.(js|vue)$/, loader: 'eslint-loader', enforce: 'pre', include: [resolve('src'), resolve('test')], options: { formatter: require('eslint-friendly-formatter'), emiterror:false, emitwarning: config.dev.showeslinterrorsinoverlay, fix: true, failonerror: true, //如果有eslint警告,加载器将导致模块构建失败。 //设置 false 即可,去除此检验 failonwarning: false, } })
但是,还是看个人喜好,若是单单在控制台提示警告也可以,不过我本人不想看到有警告,所以就硬性设为 true 不让编译通过,个人喜爱而已!
上一篇: SQLServer之修改FOREIGN KEY约束
下一篇: Oracle误删除软件目录
推荐阅读
-
Module build failed: Module failed because of a eslint warning
-
vue component 中引入less文件报错 Module build failed
-
启动react项目提示:Module build failed: SyntaxError: Unexpected token
-
Module build failed: TypeError [ERR_INVALID_ARG_TYPE]: The “from“ argument must be of type string
-
npm run dev 启动错误:Module build failed: Error: No PostCSS Config found in:xxxxxxxxxxxxxx
-
解决uniapp项目中使用vant Weapp图标组件报错问题(Module build failed from ./node_modules/postcss-loader/src/index)
-
Module build failed: Error: Cannot find module 'node-sass’
-
Module build failed: Error: Cannot find module 'node-sass' at Function.Module._resolveFilename (
-
vue项目报错:”Module build failed: Error: Cannot find module ‘node-sass‘报错问题
-
npm run dev 报错 Module build failed: Error: Cannot find module 'prettier'