feat(01-code-splitting): convert 31+ route components to React.lazy
- Replace all 31+ static route component imports in App.tsx with React.lazy() dynamic imports - Add LazyLoadingFallback.tsx shared component for Suspense fallback - Wrap <Routes> with <Suspense> for chunk loading states - Handle named exports (ImageStudio, VideoStudio, ProductMarketing, StoryProjectList) with .then() wrapper - Main bundle reduced from 8.42MB to 2.50MB (70% reduction) - 190+ chunk files created for on-demand loading per route Closes Phase 1 Plan 01-01
This commit is contained in:
28
frontend/src/components/shared/LazyLoadingFallback.tsx
Normal file
28
frontend/src/components/shared/LazyLoadingFallback.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import React from 'react';
|
||||
import { Box, CircularProgress, Typography } from '@mui/material';
|
||||
|
||||
interface LazyLoadingFallbackProps {
|
||||
message?: string;
|
||||
}
|
||||
|
||||
const LazyLoadingFallback: React.FC<LazyLoadingFallbackProps> = ({
|
||||
message = 'Loading...'
|
||||
}) => {
|
||||
return (
|
||||
<Box
|
||||
display="flex"
|
||||
flexDirection="column"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
minHeight="60vh"
|
||||
gap={2}
|
||||
>
|
||||
<CircularProgress size={40} />
|
||||
<Typography variant="body1" color="textSecondary">
|
||||
{message}
|
||||
</Typography>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default LazyLoadingFallback;
|
||||
Reference in New Issue
Block a user