Javascript ReactJS+;Webpack正在刷新页面,而不是热加载
我的react redux项目使用webpack,在浏览器中不是热重新加载。我必须手动刷新页面。不确定问题出在哪里 我的项目url是: 网页包日志如下所示Javascript ReactJS+;Webpack正在刷新页面,而不是热加载,javascript,reactjs,webpack,Javascript,Reactjs,Webpack,我的react redux项目使用webpack,在浏览器中不是热重新加载。我必须手动刷新页面。不确定问题出在哪里 我的项目url是: 网页包日志如下所示 ℹ 「wds」: Project is running at http://localhost:8080/ ℹ 「wds」: webpack output is served from / ℹ 「wds」: Content not from webpack is served from /app/build, /app/public we
ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /app/build, /app/public
webpack.common.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
bundle: ['babel-polyfill', './src/index.js'],
},
plugins: [
new HtmlWebpackPlugin({ template: './index.html', minify: true }),
],
output: {
filename: '[name].[hash].js',
path: path.resolve(__dirname, 'build'),
publicPath: '/',
},
resolve: {
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
},
};
My webpack.config.js
const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
module.exports = (env) => merge(common, {
mode: 'development',
devtool: 'eval-source-map',
devServer: {
contentBase: [path.join(__dirname, 'build'), path.join(__dirname, 'public')],
hot: true,
disableHostCheck: true,
proxy: {
'/superAdmin': {
target: 'http://localhost:3001',
secure: false,
},
},
},
module: {
rules: [
{
test: /\.(scss|css)$/,
use: [
'style-loader',
'css-loader',
'resolve-url-loader',
{ loader: 'sass-loader', options: { sourceMap: true } },
],
},
{
test: /\.(jpe?g|png|gif|woff|woff2|eot|ttf|svg)$/i,
use: [
'file-loader',
],
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
ENVIRONMENT: JSON.stringify(env)
})
]
});
我检查了我的浏览器,它显示以下错误:
注意:堆栈溢出中另一个类似问题的答案并没有为我提供解决方案。