ReactJS + Webpack正在刷新页面而不是热加载

问题描述

我使用webpack的react-redux项目未在浏览器中热加载。我必须手动刷新页面。不确定是什么问题。

我的项目网址是:https://super-chivalrous-asp.glitch.me

webpack日志正在跟踪

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'],};

webpack.common.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,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)
        })
    ]
});

我的webpack.config.js

2.5

我检查了浏览器,它显示以下错误

enter image description here

注意:堆栈溢出中另一个类似问题的答案没有为我提供解决方案。 React + Webpack HMR is refreshing the page (not hot loading)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)