@@ -5,16 +5,15 @@ import { Router, Route, Switch } from 'react-router-dom';
55import { createBrowserHistory } from 'history' ;
66import { AppContextConsumer , AppStateInterface } from './App/App' ;
77
8- import { asyncComponent } from './utils/asyncComponent' ;
98import Header from './components/Header' ;
109
1110const history = createBrowserHistory ( {
1211 basename : window . __VERDACCIO_BASENAME_UI_OPTIONS && window . __VERDACCIO_BASENAME_UI_OPTIONS . url_prefix ,
1312} ) ;
1413
15- const NotFound = asyncComponent ( ( ) => import ( './components/NotFound' ) ) ;
16- const VersionPackage = asyncComponent ( ( ) => import ( './pages/Version' ) ) ;
17- const HomePage = asyncComponent ( ( ) => import ( './pages/home' ) ) ;
14+ const NotFound = React . lazy ( ( ) => import ( './components/NotFound' ) ) ;
15+ const VersionPackage = React . lazy ( ( ) => import ( './pages/Version' ) ) ;
16+ const HomePage = React . lazy ( ( ) => import ( './pages/home' ) ) ;
1817
1918interface RouterAppProps {
2019 onLogout : ( ) => void ;
@@ -25,7 +24,7 @@ class RouterApp extends Component<RouterAppProps> {
2524 public render ( ) : ReactElement < HTMLDivElement > {
2625 return (
2726 < Router history = { history } >
28- < >
27+ < React . Suspense fallback = { null } >
2928 { this . renderHeader ( ) }
3029 < Switch >
3130 < Route exact = { true } path = { '/' } render = { this . renderHomePage } />
@@ -35,7 +34,7 @@ class RouterApp extends Component<RouterAppProps> {
3534 < Route exact = { true } path = { '/-/web/detail/@:scope/:package/v/:version' } render = { this . renderVersionPage } />
3635 < Route component = { NotFound } />
3736 </ Switch >
38- </ >
37+ </ React . Suspense >
3938 </ Router >
4039 ) ;
4140 }
0 commit comments