Skip to content

perf: lazy loading webpack-merge dependency#6668

Merged
chenjiahan merged 2 commits intomainfrom
lazy_webpack_merge_1129
Nov 30, 2025
Merged

perf: lazy loading webpack-merge dependency#6668
chenjiahan merged 2 commits intomainfrom
lazy_webpack_merge_1129

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

Lazy loading webpack-merge dependency to reduce main bundle size and make startup faster.

Before

File (esm_index)         Size
dist/index.js            0.21 kB
dist/0~range-parser.js   2.3 kB
dist/rslib-runtime.js    2.3 kB
dist/0~open.js           18.4 kB
dist/131.js              485.4 kB

                Total:   508.7 kB

After

File (esm_index)         Size
dist/index.js            0.21 kB
dist/rslib-runtime.js    2.3 kB
dist/0~range-parser.js   2.3 kB
dist/0~open.js           18.4 kB
dist/131.js              448.5 kB

                Total:   471.8 kB

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings November 29, 2025 12:36
@netlify
Copy link
Copy Markdown

netlify bot commented Nov 29, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 3014225
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/692b99034b70d40008f3ffba
😎 Deploy Preview https://deploy-preview-6668--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 54 (🔴 down 15 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements lazy loading for the webpack-merge dependency to improve startup performance and reduce the main bundle size. The change defers loading webpack-merge until it's actually needed, resulting in a ~37kB reduction in bundle size (from 508.7 kB to 471.8 kB).

Key changes:

  • Converted mergeConfig from a direct import to a lazy-loaded function wrapper
  • Added webpack-merge to the compiled packages type definitions
  • Configured webpack-merge for prebundling

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/core/src/provider/rspackConfig.ts Replaced direct merge import with lazy loading via requireCompiledPackage in the mergeConfig utility function
packages/core/src/helpers/vendors.ts Added webpack-merge type definition to the CompiledPackages interface
packages/core/prebundle.config.ts Added webpack-merge to the list of dependencies to be prebundled

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chenjiahan chenjiahan merged commit 3680000 into main Nov 30, 2025
11 checks passed
@chenjiahan chenjiahan deleted the lazy_webpack_merge_1129 branch November 30, 2025 01:25
@chenjiahan chenjiahan mentioned this pull request Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants