From bc309322a9fee1a46d1b50f8af85e7db1a7c913f Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 11 Sep 2024 14:52:00 +0800 Subject: [PATCH] fix --- .../webpack/tests/__snapshots__/webpackConfig.test.ts.snap | 3 --- packages/core/src/plugins/basic.ts | 4 ++-- packages/plugin-react/src/react.ts | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/compat/webpack/tests/__snapshots__/webpackConfig.test.ts.snap b/packages/compat/webpack/tests/__snapshots__/webpackConfig.test.ts.snap index 4e6835881b..0277bd85a4 100644 --- a/packages/compat/webpack/tests/__snapshots__/webpackConfig.test.ts.snap +++ b/packages/compat/webpack/tests/__snapshots__/webpackConfig.test.ts.snap @@ -8,9 +8,6 @@ exports[`webpackConfig > should allow to append and prepend plugins 1`] = ` }, }, RsbuildCorePlugin {}, - HotModuleReplacementPlugin { - "options": {}, - }, MiniCssExtractPlugin { "_sortedModulesCache": WeakMap {}, "options": { diff --git a/packages/core/src/plugins/basic.ts b/packages/core/src/plugins/basic.ts index 3534b64b84..8758ab11c0 100644 --- a/packages/core/src/plugins/basic.ts +++ b/packages/core/src/plugins/basic.ts @@ -17,7 +17,7 @@ export const pluginBasic = (): RsbuildPlugin => ({ setup(api) { api.modifyBundlerChain( - (chain, { env, isProd, target, bundler, environment, CHAIN_ID }) => { + (chain, { env, isDev, target, bundler, environment, CHAIN_ID }) => { const { config } = environment; chain.name(environment.name); @@ -46,7 +46,7 @@ export const pluginBasic = (): RsbuildPlugin => ({ }, }); - const usingHMR = !isProd && config.dev.hmr && target === 'web'; + const usingHMR = isDev && config.dev.hmr && target === 'web'; if (usingHMR) { chain diff --git a/packages/plugin-react/src/react.ts b/packages/plugin-react/src/react.ts index 659bf5bda2..db4b9b9c8e 100644 --- a/packages/plugin-react/src/react.ts +++ b/packages/plugin-react/src/react.ts @@ -45,9 +45,9 @@ export const applyBasicReactSupport = ( }); api.modifyBundlerChain( - async (chain, { CHAIN_ID, environment, isProd, target }) => { + async (chain, { CHAIN_ID, environment, isDev, target }) => { const { config } = environment; - const usingHMR = !isProd && config.dev.hmr && target === 'web'; + const usingHMR = isDev && config.dev.hmr && target === 'web'; if (!usingHMR) { return; }