Skip to content

Split heavy recharts and react-simple-maps dependencies into their own vendor chunk #300

Description

@Jagadeeshftw

📌 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

  • Run tests:
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

  • viz-vendor chunk emitted
  • Main chunk size reduced
  • Bundle budget still passes
  • i18n-vendor rule preserved

🔒 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

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial CampaignGrantFox official campaign issuefrontendFrontend / UI workperformancePerformance / gas / resource use

Type

Fields

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions