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

前端 未结 6 713
梦谈多话
梦谈多话 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:00

    This solution worked for me:

    module: {
            loaders:[
                {
                    test: /\.js$/,
                    exclude: /(node_modules)/,
                    loader: 'babel-loader'
                }
            ]
        }
    

    and presets in the .babelrc

    {
        'presets': ['latest', 'react', 'stage-0']
    }
    

    please refer to https://webpack.github.io/docs/usage.html

提交回复
热议问题