ERROR in ./entry.js
Module build failed: Error: React Hot Loader: The Webpack loader is now exported separately. If you use Babel, we recommend that you remove "react-hot-loader" from the "loaders" section of your Webpack configuration altogether, and instead add "react-hot-loader/babel" to the "plugins" section of your .babelrc file. If you prefer not to use Babel, replace "react-hot-loader" or "react-hot" with "react-hot-loader/webpack" in the "loaders" section of your Webpack configuration.
这个是为什么。
webpack.config.js
module.exports = {
entry:'./entry.js',
output:{
path:__dirname,
filename:'bundle.js'
},
devtool:'source-map',
module:{
loaders:[
{test:[/\.js$/,/\.jsx?$/],exclude:/(node_modules)/,loader:'react-hot!babel'},
{test:/\.css$/,loader:'style!css'}
]
}
};
react-hot!babel
是 react-hot=loader v1 的用法。v1 的热加载存在不少问题,现在已经发布 react-hot-loader v3,推荐使用。如果对 react-hot-loader 版本问题有疑问可参考 react 热加载方案