webpack project upgrade version
configuration is as follows:
webpack.json
"scripts": {
"dev": "webpack --mode development",
"build": "webpack --mode production",
"watch": "webpack --watch",
"start": "webpack-dev-server --open --config webpack.dev.js",
"build2": "webpack --config webpack.prod.js"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^6.4.1",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"clean-webpack-plugin": "^0.1.19",
"css-loader": "^0.28.10",
"file-loader": "^1.1.11",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.0.6",
....
webpack.common.js
module: {
rules: [
.... loader
{
// test: /\.(js|jsx)$/,
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader:"babel-loader",
query:{
presets: ["babel-preset-es2015", "babel-preset-react"]
// presets:[
// require.resolve("babel-preset-es2015"),
// require.resolve("babel-preset-react")
// ]
}
}
]
},
npm run build2 reported the following error when starting a project
Please correct.