Webpack - Error: Cannot define 'query' and multiple loaders in loaders list

前端 未结 6 759
梦谈多话
梦谈多话 2021-01-30 16:28

This error appeared after I added the react-hot loader in an array following this tutorial: https://thoughtbot.com/blog/setting-up-webpack-for-react-and-hot-module-

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-30 17:26

    My Solution:

    loaders: [{
      test: /\.(js|jsx)$/,
      loaders: ['react-hot', 'babel?' + JSON.stringify({
        cacheDirectory: true,
        plugins: [
          'transform-runtime',
          'transform-decorators-legacy'
        ],
        presets: ['es2015', 'react', 'stage-0'],
        env: {
          production: {
            presets: ['react-optimize']
          }
        }
      }), 'eslint'],
      include: src,
      exclude: /node_modules/
    }
    

提交回复
热议问题