-
-
Notifications
You must be signed in to change notification settings - Fork 239
feat: enable lazyCompilation.imports by default #5824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 |
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
packages/core/src/client/hmr.ts
Outdated
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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
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