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

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

    For webpack 2. I manage to configure like this:

    
    
        var webpack = require("webpack");
        var path = require("path");
    
        module.exports = {
            entry: "./src/index.js",
            output: {
                path: path.resolve(__dirname, "dist/assets"),
                filename: "bundle.js",
                publicPath: "/assets/"
            },
            devServer: {
                inline: true,
                contentBase: './dist',
                port: 3000
            },
            module: {
                loaders: [
                    {
                        test: /\.js$/,
                        exclude: /(node_modules)/,
                        loader: "babel-loader",
                        options: {
                            presets: ['latest', 'react', 'stage-0']
                        }
                    }
                ]
            }
        };
    
    

提交回复
热议问题