diff --git a/src/common/components/code-splitting/index.tsx b/src/common/components/code-splitting/index.tsx new file mode 100644 index 0000000..d39b4bb --- /dev/null +++ b/src/common/components/code-splitting/index.tsx @@ -0,0 +1,8 @@ +/** + * Just a code-splitting example. + * This component will be built into a separate chunk + * @constructor + */ +const CodeSplitting = () =>
Code-splitting in action
; + +export default CodeSplitting; diff --git a/src/pages/not-lazy/index.tsx b/src/pages/not-lazy/index.tsx index 349f3be..150c5d0 100644 --- a/src/pages/not-lazy/index.tsx +++ b/src/pages/not-lazy/index.tsx @@ -1,8 +1,13 @@ +import { Suspense } from '@lomray/consistent-suspense'; import type { FCRoute } from '@lomray/vite-ssr-boost/interfaces/fc-route'; +import { lazy } from 'react'; import { Link } from 'react-router-dom'; +import Fallback from '@components/fallback'; import RouteManager from '@services/route-manager.ts'; import styles from './styles.module.scss'; +const CodeSplitting = lazy(() => import('@components/code-splitting')); + /** * Demo page with no lazy import * @constructor @@ -10,7 +15,12 @@ import styles from './styles.module.scss'; const NotLazy: FCRoute = () => ( <>
-

Styled text

+
Styled text
+
+ }> + + +
Go back diff --git a/src/pages/not-lazy/styles.module.scss b/src/pages/not-lazy/styles.module.scss index d8f0078..f5f5fc4 100644 --- a/src/pages/not-lazy/styles.module.scss +++ b/src/pages/not-lazy/styles.module.scss @@ -1,5 +1,6 @@ .container { display: flex; + flex-direction: column; justify-content: center; }