使用node来安装react, babel webpack.fonfig.js 配置
报错:Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
注意事项:
1: path: "请使用绝对路径,
2:loaders改为rules
3:babel改为babel-loader
var
path =
require(
'path');
module.
exports = {
mode:
'production',
//入口文件
entry:
'./app/index.js',
//出口文件
output:{
filename:
'index.js',
path:path.
resolve(
__dirname,
'dist'),
publicPath:
'temp/'
},
devServer:{
contentBase:
'./',
host:
'localhost',
compress:
true,
port:
1717
},
module:{
rules:[
{
test:
/
\.
js
$
/,
exclude:
/node_modules/,
loaders:
"babel-loader",
query:{
presets:[
'es2015',
'react']
}
}
]
}
}