babel升級到6後編譯jsx代碼出錯,原因是由於6後拆分成幾個小組件,使用以下方法可以解决
.安装
npm install babel-loader babel-core babel-preset-es2015 --save-dev
.webpack.config.js的module修改为
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel', // 'babel-loader' is also a legal name to reference
query: {
presets: ['react', 'es2015']
}
}
]
},