diff --git a/config/web/webpack.config.js b/config/web/webpack.config.js index 82b42d5..f280d61 100644 --- a/config/web/webpack.config.js +++ b/config/web/webpack.config.js @@ -235,7 +235,14 @@ module.exports = function (webpackEnv) { (shouldUseSourceMap ? 'source-map' : isEnvStaging ? 'eval-cheap-module-source-map' : 'nosources-source-map'), // These are the "entry points" to our application. // This means they will be the "root" imports that are included in JS bundle. - entry: paths.appIndexJs, + entry: [ + // 模块热替换的运行时代码 + 'webpack/hot/dev-server.js', + // 用于 web 套接字传输、热重载逻辑的 web server 客户端 + 'webpack-dev-server/client/index.js?hot=true&live-reload=true', + // oak项目入口 + paths.appIndexJs, + ], output: { // The build folder. path: paths.appBuild, @@ -802,6 +809,8 @@ module.exports = function (webpackEnv) { : undefined ) ), + // 添加HMR插件支持 + new webpack.HotModuleReplacementPlugin(), // Inlines the webpack runtime script. This script is too small to warrant // a network request. // https://github.com/facebook/create-react-app/issues/5358