Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Sep 11, 2024
1 parent ff2d005 commit bc30932
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ exports[`webpackConfig > should allow to append and prepend plugins 1`] = `
},
},
RsbuildCorePlugin {},
HotModuleReplacementPlugin {
"options": {},
},
MiniCssExtractPlugin {
"_sortedModulesCache": WeakMap {},
"options": {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/plugins/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-react/src/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit bc30932

Please sign in to comment.