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 不让编译通过,个人喜爱而已!

Module build failed: Module failed because of a eslint warning的更多相关文章

  1. vue-cli 报Module build failed: Error: No parser and no file path given, couldn't infer a parser.错的解决方法

    出错提示如下: ERROR Failed to compile with errors :: error in ./src/App.vue Module build failed: Error: No ...

  2. vue.js报错:Module build failed: Error: No parser and no file path given, couldn't infer a parser.

    ERROR Failed to compile with 2 errors 12:00:33 error in ./src/App.vue Module build failed: Error: No ...

  3. 配置web pack loader 报错:Module build failed: Error: The node API for `babel` has been moved to `babel-core`.

    报错如下 Module build failed: Error: The node API for `babel` has been moved to `babel-core`. 在我配置loader ...

  4. Vue使用Typescript开发编译时提示“ERROR in ./src/main.ts Module build failed: TypeError: Cannot read property 'afterCompile' of undefined”的解决方法

    使用Typescript开发Vue,一切准备就绪.但npm start 时,提示“ ERROR in ./src/main.tsModule build failed: TypeError: Cann ...

  5. webpack报错:Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-preset-env' from '...' - Did you mean "@babel/env"?

    webpack报错:Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find mo ...

  6. Module build failed: Error: Cannot find module 'url-loader' 的坑

    本文地址:http://www.cnblogs.com/jying/p/8280956.html 开发环境:react.webpack.es5 引用图片报错:Module build failed: ...

  7. Vue, element-ui Module build failed: Error: No PostCSS Config found

    使用vue框架写pc页面时,我们经常会用到element-ui这个框架. 当我们吧把需要的东西都装在好运行项目的时候,有时会出现这样的错误, Module build failed: Error: N ...

  8. Vue+Webpack配置css-loader时报错:Module build failed: Unknown word

    使用Vue+Webpack搭建工程时,在webpack.config.js中的module的rules里针对各种文件配置加载工具.在针对css文件配置时遇到一个问题:打包构建时报错——Module b ...

  9. Module build failed: Error: Cannot find module 'node-sass'

    安装npm 遇到 Module build failed: Error: Cannot find module 'node-sass' 这次通过重装 npm 完成 先卸载npm npm uninsta ...

随机推荐

  1. 安装ubuntu14.04之后要做的一些事

    前言: 用ubuntu14.04也有一段时间了,感觉与之前版本相比还是在挺多方面有了改进.但刚装完还是有一些小问题需要自己动手解决.鉴于网上的内容太过零碎,有些方案也太过老旧,因此在这里为大家总结一些 ...

  2. 使用 Laravel 5.5+ 更好的来实现 404 响应

    译文首发于 使用 Laravel 5.5+ 更好的来实现 404 响应,转载请注明出处! Laravel 5.5.10 封装了两个有用的路由器方法,可以帮助我们为用户提供更好的 404 页面.现在,当 ...

  3. maven引入spring相关依赖

    <!--spring相关包--> <dependency> <groupId>org.springframework</groupId> <art ...

  4. 【CodeForces 271D】Good Substrings

    [链接] 我是链接,点我呀:) [题意] [题解] 字典树 我们可以两重循环(i,j) 来枚举所有的子串 即i=1,j=1,2,3... i=2,j = 2,3,4,.. 于是我们在i变化的时候(就是 ...

  5. solrj 操作 solr 集群版

    一.添加 @Test public void testAddDocument() throws Exception{ //创建一个集群的连接,应该使用 CloudSolrServer,//zkHost ...

  6. C#中的LINQ 基础

    1.LINQ的数据源 必须可枚举的,即必须是数组或者集合 (继承了IEnumerable<T>接口就可以,注意是IEnumerable<T>,不是IEnumerable接口,不 ...

  7. 洛谷—— P2668 斗地主

    https://www.luogu.org/problem/show?pid=2668 题目描述 牛牛最近迷上了一种叫斗地主的扑克游戏.斗地主是一种使用黑桃.红心.梅花.方片的A到K加上大小王的共54 ...

  8. Java向上转型和向下转型(附具体样例)

                                                Java向上转型和向下转型(附具体样例) 熬夜整理的关于Java向上和向下转型的样例,很的通俗易懂哦~~~~ 一 ...

  9. 因一段JavaScript代码引发的闲扯

    前两天,一朋友给我发了一段JavaScript代码: function f1(){ var n=999; nAdd=function(){ n+=1 }; function f2(){ alert(n ...

  10. android 检測右滑的WebView

    今天产品出新花样非得要右滑....检測到右滑手势后事件不做处理放在Activity中做对应的处理即可了. import android.app.Activity; import android.con ...