feat: enable lazyCompilation.imports by default#5824
Merged
chenjiahan merged 4 commits intomainfrom Aug 13, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 |
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
chenjiahan
reviewed
Aug 12, 2025
chenjiahan
reviewed
Aug 12, 2025
Member
There was a problem hiding this comment.
Could you explain why you changed the HMR runtime code?
Member
Author
Member
There was a problem hiding this comment.
Got it, great chart! This is very clear
chenjiahan
reviewed
Aug 12, 2025
chenjiahan
approved these changes
Aug 13, 2025
This was referenced Aug 13, 2025
Merged
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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