非开发模式不会导入hmr开发服务器,测试打包结果完成

This commit is contained in:
pqcqaq 2024-10-26 21:29:00 +08:00
parent 48ea930c00
commit 1705f5fd07
1 changed files with 3 additions and 3 deletions

View File

@ -238,9 +238,9 @@ module.exports = function (webpackEnv) {
// This means they will be the "root" imports that are included in JS bundle.
entry: [
// 模块热替换的运行时代码
'webpack/hot/dev-server.js',
...(!!isEnvDevelopment? ['webpack/hot/dev-server.js',
// 用于 web 套接字传输、热重载逻辑的 web server 客户端
'webpack-dev-server/client/index.js?hot=true&live-reload=true',
'webpack-dev-server/client/index.js?hot=true&live-reload=true'] : []),
// oak项目入口
paths.appIndexJs,
],
@ -813,7 +813,7 @@ module.exports = function (webpackEnv) {
)
),
// 添加HMR插件支持
new webpack.HotModuleReplacementPlugin(),
!!isEnvDevelopment && 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