Javascript webpack开发中间件,如何在HMR失败时自动加载

Javascript webpack开发中间件,如何在HMR失败时自动加载,javascript,webpack,Javascript,Webpack,更改javascript源代码时,我在浏览器控制台中收到以下消息: [HMR]无法热更新以下模块:(完全重新加载) 需要)这通常是因为模块已更改(和 他们的父母)不知道如何热装自己。看见 更多细节 我的问题是,发生这种情况时,我如何告诉webpack自动重新加载页面 以下是我的服务器设置: app.use(morgan('dev')); // Disable views cache app.set('view cache', false); v

更改javascript源代码时,我在浏览器控制台中收到以下消息:

[HMR]无法热更新以下模块:(完全重新加载) 需要)这通常是因为模块已更改(和 他们的父母)不知道如何热装自己。看见 更多细节

我的问题是,发生这种情况时,我如何告诉webpack自动重新加载页面

以下是我的服务器设置:

app.use(morgan('dev'));

        // Disable views cache
        app.set('view cache', false);

        var webpack = require('webpack');

        var webpackConfig = require('../client/webpack.config');
        var compiler = webpack(webpackConfig);

        app.use(require("webpack-dev-middleware")(compiler, {
            noInfo: true, publicPath: webpackConfig.output.publicPath
        }));
        app.use(require("webpack-hot-middleware")(compiler));
和我的webpack.config:

var path = require('path');
var AureliaWebpackPlugin = require('../node_modules/aurelia-webpack-plugin');
var webpack = require('../node_modules/webpack');

module.exports = {
    entry: {
        main: [
            'webpack-hot-middleware/client',
            './client/src/main'
        ]
    },
    resolve: {
        alias: {
            breeze: 'breeze-client/build/breeze.debug',
            resources: path.resolve( __dirname, 'src', 'resources'),
            utils: path.resolve( __dirname, 'src', 'resources', 'utils', 'utils'),
            tradestudyUtils: path.resolve( __dirname, 'src', 'resources', 'tradestudy-utils', 'tradestudy-utils')
        }
    },
    output: {
        path: path.join(__dirname, 'client'),
        filename: 'bundle.js',
        publicPath: '/'
    },
    devtool: 'eval',
    plugins: [
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin(),
        new AureliaWebpackPlugin()
    ],
    module: {
        //preLoaders: [
        //    {test: /\.js$/, exclude: /node_modules/, loader: 'eslint-loader'}
        //],
        loaders: [
            { test: /\.scss$/, loaders: ['style', 'css', 'sass'] },
            { test: /\.js$/, loader: 'babel', exclude: /node_modules/, query: { presets: ['es2015-loose', 'stage-1'], plugins: ['transform-decorators-legacy'] } },
            { test: /\.css?$/, loader: 'style!css' },
            { test: /\.html$/, loader: 'raw' },
            { test: /\.(png|gif|jpg)$/, loader: 'url-loader?limit=8192' },
            { test: /\.woff2(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader?limit=10000&minetype=application/font-woff2' },
            { test: /\.woff(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader?limit=10000&minetype=application/font-woff' },
            { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file-loader' }
        ]
    }
};
提前感谢?

您可以将
重新加载
传递到
网页包热中间件/客户端

    entry: {
        main: [
            'webpack-hot-middleware/client?reload=true',
            './client/src/main'
        ]
    },

这会刷新整个页面还是真的是“热模块替换”?我的设置略有不同,但我在条目中的aurelia bootstrapper之前添加了“webpack热中间件/客户端?reload=true”,这是热模块替换