文本webpack报错关于loaders的报错

求大神指点
这个是报错的地方

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

  • configuration.module has an unknown property 'loaders'. These properties are valid:
    object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, defaultRules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp?, strictExportPresence?, strictThisContextOnImports? }
    -> Options affecting the normal modules (NormalModuleFactory).

我的代码config.js是

module.exports = {
  devtool: "source-map",
  entry: __dirname + "/app/main.js",
  output:{
    path: __dirname + "/public/",
    filename:"bundle.js"
  },
  devServer:{
    contentBase:"./public",
    port:"9000",
    inline:true,
    historyApiFallback:true
  },
  module: {
        loaders: [{
            test: /\.json$/,
            loader: "json"
        }, {
            test: /\.js$/,
            exclude: /node_modules/, 
            loader: "babel",
            query: {
                presets: ['es2015', 'react']
            }
        }]
    }



}
阅读 1.7k
1 个回答

module应该是rule吧

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进