Commit 11bc78c
perf: bundle optimization with code splitting and vendor chunking (#4709)
## Summary
- **Route-level code splitting**: Lazy-load 5 pages (CatalogPage,
LegalPage, McpPage, InteractivePage, DebugPage) via React Router
`lazy()`
- **PrismLight**: Switch from full Prism (37+ languages) to
`prism-light` with only Python registered, removing ~36 unused language
grammars
- **Vendor chunk splitting**: Split React/MUI into separate cached
chunks via `manualChunks` — users only re-download app code on updates
- **API preconnect**: Add `<link rel="preconnect">` for `api.pyplots.ai`
to reduce initial API latency
### Build output (before → after)
| Chunk | Size | Gzipped |
|-------|------|---------|
| `vendor-*.js` | 98 KB | 33 KB |
| `mui-*.js` | 320 KB | 99 KB |
| `index-*.js` | 344 KB | 108 KB |
| Lazy pages | 3-11 KB each | 1-3 KB each |
Main bundle reduced from ~1.3 MB to 344 KB with vendor/MUI cached
separately.
## Test plan
- [x] `yarn build` succeeds with expected chunk split
- [x] All 44 tests pass
- [ ] Verify syntax highlighting works on spec pages (Code tab)
- [ ] Verify lazy-loaded pages load correctly (catalog, legal, mcp,
debug, interactive)
Closes #4704
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 393f243 commit 11bc78c
File tree
4 files changed
+29
-11
lines changed- app
- src
- components
4 files changed
+29
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | 9 | | |
13 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
20 | | - | |
21 | | - | |
22 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
29 | | - | |
| 32 | + | |
30 | 33 | | |
31 | | - | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
14 | 24 | | |
0 commit comments