Webpack error with react

后端 未结 2 2487
北海茫月
北海茫月 2021-02-20 16:34

I am trying to configure webpack according to this tutorial and keep getting the same error. I am having trouble debugging these 2 messages:

ERROR in ./app.js
M         


        
2条回答
  •  忘了有多久
    2021-02-20 17:21

    the loaders option should be nested in a module object like so:

    module.exports = {
      context: __dirname + '/app',
      entry: {
        javascript: "./app.js",
        html: "./index.html"
      },
      output: {
        filename: 'app.js',
        path: __dirname + '/dist'
      },
      module: {
        loaders: [
          {
            test: /\.js$/,
            exclude: /node_modules/,
            loaders: ['babel-loader']
          },
          {
            test: /\.jsx$/,
            loaders: ['babel-loader']
          },
          {
            test: /\.html$/,
            loader: "file?name=[name].[ext]"
          }
        ]
      }
    };
    

    I also added a missing semi-colon at the end ;)

提交回复
热议问题