Skip to content

perf(build): Add vendor chunk splitting for heavy stable dependencies#109635

Draft
scttcper wants to merge 2 commits intoscttcper/rspack-deterministic-idsfrom
scttcper/rspack-vendor-chunks
Draft

perf(build): Add vendor chunk splitting for heavy stable dependencies#109635
scttcper wants to merge 2 commits intoscttcper/rspack-deterministic-idsfrom
scttcper/rspack-vendor-chunks

Conversation

@scttcper
Copy link
Member

@scttcper scttcper commented Feb 28, 2026

Stacked on #109631.

Without explicit cache groups, stable heavy dependencies get mixed into app chunks and their browser-cached copies are invalidated on every app code deploy — even when the library versions haven't changed.

This adds vendor cache groups for three groups of packages:

  • vendor-react — React, React DOM, React Router, framer-motion, React Aria/Stately/Types, and all @emotion/* packages. The full UI rendering ecosystem. These are used across hundreds of files but change only when deps are bumped.
  • vendor-tanstack — TanStack Query, Form, Virtual, Pacer. Stable API/data layer.
  • vendor-echarts — echarts + zrender. Largest single dependency (~400KB min), statically imported in 162 files with no dynamic imports anywhere.

Also raises maxAsyncRequests from 10 → 30. The cap was preventing legitimate async chunk splits on complex routes; with HTTP/2 multiplexing the rspack default of 30 is appropriate.

Co-Authored-By: Claude noreply@anthropic.com

Without explicit cache groups, stable heavy dependencies (React, Emotion,
TanStack Query, echarts, etc.) get mixed into app chunks and their cached
copies are invalidated on every app code deploy.

Add vendor cache groups for:
- vendor-react: React, React DOM, React Router, framer-motion, React Aria,
  React Stately, React Types — the full UI runtime ecosystem
- vendor-emotion: emotion CSS-in-JS packages
- vendor-tanstack: TanStack Query, Form, Virtual, Pacer
- vendor-echarts: echarts + zrender charting library (~400KB min)

Also raise maxAsyncRequests from 10 to 30 — the previous limit was
unnecessarily restricting async chunk splits on complex routes. With
HTTP/2 the default of 30 is appropriate.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 28, 2026
emotion is React-specific and always loaded alongside React.
Combining them simplifies the chunk structure from four vendor groups
to three without meaningful cache granularity loss.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant