使用webpack打包React时出错Error: options/query provided without loader

#出现的问题截图

使用webpack打包React时出错Error: options/query provided without loader_第1张图片

代码:

 

module: { 
    rules: [ 
        { 
            test: /(\.jsx|\.js)$/,
            use: { 
                loader: "babel-loader", 
                options: { presets: [ "env", "react" ] }
            },
            exclude: /node_modules/ 
        }
    ]
}


修改为:

   module: {
        rules: [{
            test: "/(\.js|\.jsx)$/",
            loader: "babel-loader",
            query: {
            presets: [
                "env", "react"
            ]},
            exclude: /node_module/
        }]
    }

完美解决

 

你可能感兴趣的:(使用webpack打包React时出错Error: options/query provided without loader)