How to prevent webpack to fail build on eslint error?
10,797
Solution 1
i guess with the new eslint/webpack stuff, this is default behaviour.
So this is my workaround in my .lintrc.js file:
'no-console': process.env.NODE_ENV === 'production' ? 2 : 1
Solution 2
You can force ESLint to always emit just warnings instead of errors by webpack configuration. That will not stop your build as you expect. You need to set emitWarning
option to true
in your webpack.config.js file.
eg.
module.exports = {
module: {
rules: [
{
test: /\.vue$/,
exclude: /node_modules/,
loader: "eslint-loader",
options: {
emitWarning: true
}
}
]
}
};
You can read more in the documentation https://github.com/webpack-contrib/eslint-loader#errors-and-warning
Author by
johannesdz
Updated on June 04, 2022Comments
-
johannesdz almost 2 years
i used the default vue-cli command to create a vue project.
When webpack is building, it fails, as shown in the image:
I am not using any special webpack configuration. What am i doing wrong?
My package.json:
{ "name": "myapp", "version": "0.1.0", "private": true, "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint" }, "dependencies": { "core-js": "^3.4.4", "firebase": "^7.6.2", "register-service-worker": "^1.6.2", "vue": "^2.6.10", "vue-router": "^3.1.3", "vuex": "^3.1.2" }, "devDependencies": { "@vue/cli-plugin-babel": "^4.1.0", "@vue/cli-plugin-eslint": "^4.1.0", "@vue/cli-plugin-pwa": "^4.1.0", "@vue/cli-plugin-router": "^4.1.0", "@vue/cli-plugin-vuex": "^4.1.0", "@vue/cli-service": "^4.1.0", "babel-eslint": "^10.0.3", "eslint": "^5.16.0", "eslint-plugin-vue": "^5.0.0", "node-sass": "^4.12.0", "sass-loader": "^8.0.0", "vue-template-compiler": "^2.6.10" }, "browserslist": [ "> 1%", "last 2 versions" ] }