我正在使用Webpack和React Hot Loader v3。在開發過程中,它大多按預期工作。不過,我期待hotloading功能與React使用Webpack進行熱加載3並在生產
webpack --progress -p
但是我發現了,而不是重複這種錯誤時輸出靜態包文件時被禁用;
這是我的WebPack配置;
var path = require('path');
var webpack = require('webpack');
module.exports = {
devServer: {
publicPath: '/js/',
hot: false,
historyApiFallback: true,
port: process.env.PORT || 3000
},
devtool: 'eval-source-map',
entry: [
'react-hot-loader/patch',
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./js/app/index'
],
output: {
path: path.join(__dirname, '/web/js/'),
filename: 'bundle.js',
publicPath: '/js/'
},
plugins: [
new webpack.HotModuleReplacementPlugin()
],
module: {
loaders: [
{
test: /\.css$/,
loader: "style-loader!css-loader?modules",
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['es2015', 'react', 'stage-0'],
plugins: ['transform-flow-strip-types'],
cacheDirectory: true
},
include: path.join(__dirname, '/js/')
}
]
}
};
我得到了建議嘗試禁用HotModuleReplacementPlugin()
,但同樣的錯誤仍然會發生。關於我在這裏失蹤的任何想法?