Deploying React AppsEntry 11 of 11
Summary
| Concept | React | Angular |
|---|---|---|
| Lazy component | lazy(() => import('./Page')) | loadComponent |
| Lazy route group | Route lazy / nested import() | loadChildren |
| Lazy loader/resolver | loader: () => import(...).then(m => m.loader()) | Resolvers in lazy routes file |
| Loading fallback | <Suspense fallback> | @defer + @loading (templates) |
| Modern route splitting | Route lazy property | loadComponent |
| Build | npm run build → dist/ | ng build → dist/<project>/browser/ |
| Env config | .env + import.meta.env.VITE_* | environment.ts + fileReplacements |
| Static host | Firebase, Netlify, Vercel, etc. | Same |
| SPA rewrites | All paths → /index.html | Same |
| Sub-path | Vite base + router basename | --base-href |
Deploying a React SPA means shrinking the initial bundle with lazy loading, building static files, uploading them to a static host, and adding a rewrite so deep links reach the router. Angular follows the same path: lazy routes and @defer for splitting, ng build for output, and the same index.html rewrite on the server.