perf: dynamic-import chart.js in FitnessChart
Chart.js (~244 KB) was a top-level import, so every route that referenced FitnessChart.svelte transitively pulled it. Defer it to an async block inside onMount so non-stats fitness routes (workout, check-in, nutrition, history list) no longer ship chart.js. - `ChartCtor` holds the async-loaded constructor - `disposed` guard handles unmount during the import - theme MutationObserver / matchMedia wiring moved inside the async block so it only attaches once the chart actually exists
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
Order = impact. Font items + app.html preload intentionally skipped.
|
||||
|
||||
- [x] 1. Lucide subpath imports — convert `from '@lucide/svelte'` barrel imports to `@lucide/svelte/icons/<kebab-name>` so Vite tree-shakes per-icon (current 748 KB shared chunk)
|
||||
- [ ] 2. Chart.js dynamic import in `FitnessChart.svelte` (drop 244 KB from non-stats fitness routes)
|
||||
- [x] 2. Chart.js dynamic import in `FitnessChart.svelte` (drop 244 KB from non-stats fitness routes)
|
||||
- [ ] 3. Recipe `all_brief` endpoint — drop `JSON.parse(JSON.stringify(...))`, move shuffle client-side, enable caching
|
||||
- [ ] 4. Favorites page — drop unnecessary `all_brief` fetch (verify consumer first)
|
||||
- [ ] 5. Replace redundant `locals.auth()` with `locals.session` across recipe/calendar/fitness loaders
|
||||
|
||||
Reference in New Issue
Block a user