Skip to content

perf(core): minify large third-party chunks#8160

Merged
chenjiahan merged 1 commit into
mainfrom
chenjiahan/perf-minify-third-party-chunks
Jul 22, 2026
Merged

perf(core): minify large third-party chunks#8160
chenjiahan merged 1 commit into
mainfrom
chenjiahan/perf-minify-third-party-chunks

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Summary

This PR fully minifies nine large @rsbuild/core chunks composed primarily of third-party code while preserving readable output for the remaining chunks. It also updates Rslib's indirect @rsbuild/core resolution from 2.1.6 to 2.1.7 to enable multiple JS minimizer options.

Chunk Before After Reduction
open.js 19.0 kB 9.7 kB 48.9%
launch-editor-middleware.js 30.2 kB 15.4 kB 48.9%
manifest-plugin.js 37.6 kB 16.9 kB 55.1%
chokidar.js 43.7 kB 21.3 kB 51.3%
connect-next.js 46.5 kB 22.2 kB 52.1%
tinyglobby.js 86.9 kB 37.1 kB 57.3%
ws.js 97.0 kB 49.4 kB 49.1%
http-proxy-middleware.js 163.0 kB 72.8 kB 55.3%
memfs.js 326.3 kB 160.4 kB 50.9%
Total 850.1 kB 405.2 kB 52.3%

The selected chunks' gzip size decreases from 157.2 kB to 117.1 kB (-25.5%). The complete Node output decreases from 1408.0 kB to 963.0 kB (-31.6%), with gzip decreasing from 291.6 kB to 251.5 kB (-13.8%). Measurements were collected from packages/core/dist after pnpm --filter @rsbuild/core run build, using gzip level 9.

Related Links

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The node library configuration adds a regular expression for selected third-party chunks. Matching chunks use fully enabled JavaScript minification, while other chunks retain the existing minification options with matching chunks excluded. The shared nodeMinifyConfig export now uses satisfies Rsbuild.Minify rather than an explicit type annotation.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: minifying large third-party chunks in core.
Description check ✅ Passed The description is directly related to the change set and explains the minification goal and impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/rslib.config.ts`:
- Around line 210-221: Update the minify configuration in the production node
build to spread the shared nodeMinifyConfig before overriding jsOptions,
preserving its CSS-disabled setting while retaining the specialized jsOptions
entries for fullyMinifiedChunks and nodeMinifyConfig.jsOptions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f4abd63a-3508-44d3-a66b-d886da8d90f1

📥 Commits

Reviewing files that changed from the base of the PR and between a5818c9 and 84a6ff3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • packages/core/rslib.config.ts
  • scripts/config/rslib.config.ts

Comment thread packages/core/rslib.config.ts
@chenjiahan
chenjiahan merged commit 44805db into main Jul 22, 2026
7 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/perf-minify-third-party-chunks branch July 22, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant