Skip to content

Commit

Permalink
fix(webpack): react-refresh-webpack-plugin cause rebuild slow (#1808)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored and caohuilin committed Oct 13, 2022
1 parent c9eb510 commit a72ff6f
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 86 deletions.
7 changes: 7 additions & 0 deletions .changeset/twelve-spoons-burn.md
@@ -0,0 +1,7 @@
---
'@modern-js/webpack': patch
---

fix(webpack): react-refresh-webpack-plugin cause rebuild slow

fix(webpack): 修复 react-refresh-webpack-plugin 导致重新编译慢的问题
2 changes: 1 addition & 1 deletion packages/builder/webpack-builder/package.json
Expand Up @@ -78,7 +78,7 @@
"@modern-js/server": "workspace:*",
"@modern-js/types": "workspace:*",
"@modern-js/utils": "workspace:*",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.5",
"@modern-js/react-refresh-webpack-plugin": "0.5.8",
"@svgr/webpack": "6.2.1",
"@types/mini-css-extract-plugin": "2.2.0",
"caniuse-lite": "^1.0.30001332",
Expand Down
2 changes: 1 addition & 1 deletion packages/builder/webpack-builder/src/plugins/react.ts
Expand Up @@ -9,7 +9,7 @@ export const PluginReact = (): BuilderPlugin => ({
return;
}
const { default: ReactFastRefreshPlugin } = await import(
'@pmmmwh/react-refresh-webpack-plugin'
'@modern-js/react-refresh-webpack-plugin'
);
const config = api.getBuilderConfig();
const useTsLoader = Boolean(config.tools?.tsLoader);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/webpack/package.json
Expand Up @@ -48,7 +48,7 @@
"@modern-js/babel-preset-app": "workspace:*",
"@modern-js/css-config": "workspace:*",
"@modern-js/utils": "workspace:*",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
"@modern-js/react-refresh-webpack-plugin": "0.5.8",
"@svgr/webpack": "^6.2.1",
"core-js": "^3.25.0",
"css-minimizer-webpack-plugin": "^3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/webpack/src/config/features/react-refresh.ts
Expand Up @@ -2,7 +2,7 @@ import { CHAIN_ID } from '@modern-js/utils';
import type { ChainUtils } from '../shared';

export function applyReactRefreshPlugin({ chain }: ChainUtils) {
const ReactFastRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const ReactFastRefreshPlugin = require('@modern-js/react-refresh-webpack-plugin');

chain.plugin(CHAIN_ID.PLUGIN.REACT_FAST_REFRESH).use(ReactFastRefreshPlugin, [
{
Expand Down
125 changes: 43 additions & 82 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a72ff6f

Please sign in to comment.