Skip to content

Conversation

GiveMe-A-Name
Copy link
Member

@GiveMe-A-Name GiveMe-A-Name commented Aug 12, 2025

Summary

  • Enable lazyCompilation.imports by default.
    We need specify lazyCompilation.entries as false , because rspack will enable lazyCompilation.entries if you pass a object as lazyCompilation. more detail see: Rspack configuration.lazyCompilation

  • In lazyCompilation, we will do a hmr compile quickly, so we maybe complete the hmr compile before web socket connect done. It means we need do a hmr action when first web socket message send.

Related Links

Checklist

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

@Copilot Copilot AI review requested due to automatic review settings August 12, 2025 09:31
Copy link
Contributor

@Copilot 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 enables lazy compilation imports by default in the development configuration. Lazy compilation is a webpack/Rspack feature that delays the compilation of certain modules until they are actually requested, which can improve development build performance.

  • Added default lazy compilation configuration with imports enabled and entries disabled
  • Updated test snapshots to reflect the new default configuration
  • Simplified HMR client code by removing first compilation tracking logic

Reviewed Changes

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

Show a summary per file
File Description
packages/core/src/defaultConfig.ts Adds default lazy compilation configuration with imports enabled
packages/core/src/client/hmr.ts Simplifies HMR logic by removing first compilation state tracking
packages/core/tests/snapshots/*.snap Updates test snapshots to include new lazy compilation defaults
packages/compat/webpack/tests/snapshots/default.test.ts.snap Updates webpack compatibility test snapshots
e2e/cases/nonce/dynamic-chunk/index.test.ts Adds wait condition for dynamic chunk loading in tests

Copy link

netlify bot commented Aug 12, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit dc14ba0
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/689c06842018d300082f12db
😎 Deploy Preview https://deploy-preview-5824--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: 67 (🔴 down 13 from production)
Accessibility: 97 (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
Contributor

github-actions bot commented Aug 12, 2025

📝 Ran ecosystem CI: Open

suite result
modernjs ❌ failure
plugins ❌ failure
rspress ❌ failure
rstest ✅ success
examples ✅ success
rslib ✅ success

Copy link
Member

Choose a reason for hiding this comment

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

Could you explain why you changed the HMR runtime code?

Copy link
Member Author

Choose a reason for hiding this comment

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

image Web socket connect too slow, so serve side will do first `lazyCompilation` completely quickly. But at this time, web socket is not connected. So we need do a hmr action when web socket connect.

Copy link
Member

Choose a reason for hiding this comment

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

Got it, great chart! This is very clear

@chenjiahan chenjiahan merged commit ea5491b into main Aug 13, 2025
11 checks passed
@chenjiahan chenjiahan deleted the enable_lazy_compilation_0812 branch August 13, 2025 05:30
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