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:
ajaysi
2026-05-08 08:27:15 +05:30
parent 4df1adfbe2
commit 8ee042bd2c
2 changed files with 170 additions and 131 deletions

View 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;