Skip to content

Commit 3cdcc0e

Browse files
committed
perf: 增加预加载, 优化主要加载代码加载耗时
1 parent 7644924 commit 3cdcc0e

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

client/web/src/App.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,29 @@ import isElectron from 'is-electron';
2020

2121
const AppRouter: any = isElectron() ? HashRouter : BrowserRouter;
2222

23-
const MainRoute = Loadable(() => import('./routes/Main'));
23+
const MainRoute = Loadable(
24+
() =>
25+
import(
26+
/* webpackChunkName: 'main' */ /* webpackPreload: true */ './routes/Main'
27+
)
28+
);
2429

25-
const EntryRoute = Loadable(() => import('./routes/Entry'));
30+
const EntryRoute = Loadable(
31+
() =>
32+
import(
33+
/* webpackChunkName: 'entry' */ /* webpackPreload: true */ './routes/Entry'
34+
)
35+
);
2636

2737
const PanelRoute = Loadable(() => import('./routes/Panel'));
2838

29-
const InviteRoute = Loadable(() => import('./routes/Invite'));
39+
const InviteRoute = Loadable(
40+
() =>
41+
import(
42+
/* webpackChunkName: 'invite' */ /* webpackPreload: true */
43+
'./routes/Invite'
44+
)
45+
);
3046

3147
const AppProvider: React.FC<PropsWithChildren> = React.memo((props) => {
3248
return (

0 commit comments

Comments
 (0)