📌 Description
vite.config.ts only carves react-intl/@formatjs/intl-messageformat into an i18n-vendor chunk. The charting (recharts) and mapping (react-simple-maps, d3-geo) libraries are large and used by only a few pages (DataPage, ApplicationsChart, leaderboard map). Extend manualChunks to isolate recharts/d3/react-simple-maps into a dedicated viz-vendor chunk so they cache independently and stay out of the main chunk.
💡 Why it matters: Bundling charts/maps into the main chunk bloats first load for users who never open analytics pages.
🧩 Requirements and context
- Extend
manualChunks(id) to return 'viz-vendor' for recharts, d3, d3-geo, and react-simple-maps.
- Keep the existing
i18n-vendor rule.
- Confirm the main
index-*.js chunk shrinks and stays within the bundle budget.
- Validate via
npm run analyze and npm run test:bundle-size.
Non-functional requirements
- Must be secure, tested, and documented.
- Should be efficient and easy to review.
🛠️ Suggested execution
1. Fork the repo and create a branch
git checkout -b perf/viz-vendor-chunk
2. Implement changes
- Write/modify the relevant source:
vite.config.ts
- Write comprehensive tests: bundle-size script
- Add documentation: README bundle analysis note
- Include TSDoc doc comments where touched
- Validate security assumptions: no behavior change, only chunking
3. Test and commit
npm run build && npm run test:bundle-size && npm run analyze
- Cover edge cases: ensure no circular chunk issues
- Include test output and security notes in the PR description.
Example commit message
perf(build): isolate recharts and maps into viz-vendor chunk
✅ Acceptance criteria
🔒 Security notes
Chunk splitting must not alter module evaluation order in a way that breaks runtime.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
vite.config.tsonly carvesreact-intl/@formatjs/intl-messageformatinto ani18n-vendorchunk. The charting (recharts) and mapping (react-simple-maps,d3-geo) libraries are large and used by only a few pages (DataPage,ApplicationsChart, leaderboard map). ExtendmanualChunksto isolaterecharts/d3/react-simple-mapsinto a dedicatedviz-vendorchunk so they cache independently and stay out of the main chunk.🧩 Requirements and context
manualChunks(id)to return'viz-vendor'forrecharts,d3,d3-geo, andreact-simple-maps.i18n-vendorrule.index-*.jschunk shrinks and stays within the bundle budget.npm run analyzeandnpm run test:bundle-size.Non-functional requirements
🛠️ Suggested execution
1. Fork the repo and create a branch
2. Implement changes
vite.config.ts3. Test and commit
Example commit message
✅ Acceptance criteria
viz-vendorchunk emitted🔒 Security notes
Chunk splitting must not alter module evaluation order in a way that breaks runtime.
📋 Guidelines