简体   繁体   English

在 npm run build 之前检查 jshint 错误

[英]Check jshint errors before npm run build

I have setup webpack using npm.我已经使用 npm 设置了 webpack。 I installed jshint using npm install jshint --save-dev .我使用npm install jshint --save-dev

Now if I run command jshint assets/js/index.js i get errors.现在,如果我运行命令jshint assets/js/index.js我得到错误。

I want to check the errors on npm run build我想检查npm run build上的错误

You can change your build script in the package.json in the way to run lint and then if it successful run build.您可以通过运行 lint 的方式更改 package.json 中的构建脚本,如果成功则运行构建。 See example查看示例

{
...
  "scripts": {
    "build": "npm run lint && your_build_command",
    "lint": "jshint assets/js/index.js"
   }
...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM