0
我想用webpack配置babel。到目前为止,我已经看到了两条路线,并且想知道有什么不同。用webpack配置babel
路径1 在webpack.config.js文件包括以下
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
}]
路径2在webpack.config.js包括下列
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
,并包括以下在单独的.babelrc文件中
{
"presets": [
"es2015"
]
}
两者有什么区别什么是首选方法?