Files
KArtSell.Aegis/docs/CURRENT/AEG-X-002_ROUTE_CODE_SPLITTING.md

2.6 KiB

AEG-X-002 — Route Code-Splitting Refactoring

  • WBS / Requirement: AEG-X-002 / REQ-PLAT-TOOL
  • Classification: behavior-preserving frontend build refactoring
  • Selected on: 2026-08-08

Source / Assumption / Unknown / Decision Required

  • Source: frontend/src/app/router.ts and the co-located tracked router.js initially statically import every route component; the actual 2026-08-08 production build reports a 501.14 kB gzip initial JavaScript chunk. A first TypeScript-only refactoring did not change build output, demonstrating that the Vite resolver uses the co-located JavaScript router entry in this repository.
  • Assumption: Vue Router's supported lazy route-component function preserves every route path, metadata, guard behavior, and component API while moving feature code out of the initial chunk.
  • Unknown: an approved application performance budget is not present. Chunk reduction is an observation, not a performance-gate pass.
  • Decision Required: none for this refactoring. Budget approval, visual evidence, and large-list interaction evidence remain separate work.

Change

  • Replace route component static imports with lazy import() factories in both active co-located router entries.
  • Load only the selected, validated UI provider at bootstrap instead of statically bundling both provider implementations and their vendor dependencies.

Acceptance Evidence

  • All existing route paths and metadata remain unchanged.
  • pnpm test passed: 26 files / 58 tests. Preserved output: evidence/AEG-X-002/frontend-regression-route-split_20260808.log.
  • pnpm build passed. Preserved output: evidence/AEG-X-002/frontend-build-route-split_20260808.log.
  • The initial gzip JavaScript chunk changed from 501.14 kB to 423.76 kB and page chunks are emitted separately. Vite still warns because its default raw-size threshold is exceeded; the threshold was not changed and this is not an approved performance-gate pass.
  • The selected-provider bootstrap refactoring is covered by frontend/src/shared/ui/provider/tests/resolveUiProvider.spec.ts: the native provider resolves and an unsupported provider rejects before mount. The final full regression result is 27 files / 60 tests, preserved in evidence/AEG-X-002/frontend-regression-provider-lazy_20260808.log.
  • Final provider-lazy build evidence is evidence/AEG-X-002/frontend-build-provider-lazy_20260808.log. The app bootstrap chunk is 20.51 kB (7.35 kB gzip); the selected PrimeVue/AG Grid provider is a separate 1,515.61 kB (393.82 kB gzip) lazy chunk.

No API, provider, policy, database, capability, or route authorization behavior changes.