search

Home  >  Q&A  >  body text

javascript - How to configure jshint in webpack.config file (webpack2.X)?

This is what was written in the webpack.config file before using webpack1.X

npm install jshint-loader --save-dev

var path = require('path');
var APP_PATH = path.resolve(ROOT_PATH, 'app');
module: {
    preLoaders: [
      {
        test: /\.jsx?$/,
        include: APP_PATH,
        loader: "jshint-loader"
      }
    ],
    jshint: {
    "esnext": true
  }
}
现在webpack2.X preLoaders跟jshint的写法都变了,我应该怎么修改下config代码??
黄舟黄舟2866 days ago628

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-16 13:44:30

    module:{
        rules:[
           {
                test: /\.(jsx|js)/,
                use: {
                    loader:'jshint-loader',
                    options: {esnext: true}
                },
                enforce: 'pre',
                include: APP_PATH,
                exclude: /node_modules/
            }
        ]
    }
    

    reply
    0
  • Cancelreply