[英]Using react-hot-loader with Babel 6
I have upgraded to Babel 6 and trying to make it working with react-hot-loader, in the webpack.config file, I have this: 我已经升级到Babel 6,并试图使其与react-hot-loader一起使用,在webpack.config文件中,我具有以下内容:
loaders: [{
test: /\.js$/,
loaders: ['react-hot', 'babel'],
include: path.join(__dirname, 'app'),
query: {
presets: ['react', 'es2015', 'stage-0']
}
}
The config above gives this error: 上面的配置给出此错误:
Cannot define 'query' and multiple loaders in loaders list"
Webpack is probably confused whether if the query is for react-hot-loader
or babel
. 无论查询是针对
react-hot-loader
还是babel
Webpack都可能会感到困惑。
How can I work around this issue? 如何解决此问题?
Here is an excerpt of the webpack.config.js
file I use: 这是我使用的
webpack.config.js
文件的摘录:
loaders: [{
test: /\.jsx?$/,
loaders: ['react-hot', 'babel-loader?presets[]=react,presets[]=es2015,presets[]=stage-0']
}
As you can see the presets for babel can be specified directly in the loaders
section. 如您所见,可以在
loaders
部分直接指定babel的预设。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.