-
Notifications
You must be signed in to change notification settings - Fork 232
fix: allow to enable lazy compilation via Rspack config #4928
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
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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 updates the dev middleware to detect lazy compilation from Rspack’s experiments.lazyCompilation
setting (in addition to Rsbuild’s own dev.lazyCompilation
), and adds E2E tests to verify both configuration paths.
- core: replace direct
dev.lazyCompilation
check with a helper that readsexperiments.lazyCompilation
(and should also fall back todev.lazyCompilation
) - e2e: remove hard-coded
dev.lazyCompilation
in config and add tests for both Rsbuild and Rspack experiment flags
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
packages/core/src/server/devMiddlewares.ts | Add isLazyCompilationEnabled helper using Rspack experiments and wire up middleware |
e2e/cases/lazy-compilation/basic/rsbuild.config.ts | Remove legacy dev.lazyCompilation from sample config |
e2e/cases/lazy-compilation/basic/index.test.ts | Add tests for both Rsbuild dev.lazyCompilation and tools.rspack.experiments.lazyCompilation |
Comments suppressed due to low confidence (3)
packages/core/src/server/devMiddlewares.ts:69
- You removed the
dev
parameter from the middleware setup, but it’s needed to readdev.lazyCompilation
. Consider re-addingdev
to the destructure so it can be passed into your lazy check.
const applyDefaultMiddlewares = async ({
e2e/cases/lazy-compilation/basic/rsbuild.config.ts:9
- [nitpick] The sample config no longer includes
dev.lazyCompilation
; consider adding a second E2E variant that exercises the legacy flag in the actual config file, not just via thedev()
call override.
page2: './src/page2/index.js',
packages/core/src/server/devMiddlewares.ts:135
- The helper only checks
experiments.lazyCompilation
, but Rsbuild’s owndev.lazyCompilation
was removed from the condition. Re-includedev.lazyCompilation
(from the originaldev
parameter) in this function so both flags enable lazy compilation.
const isLazyCompilationEnabled = () => {
Summary
Rsbuild now checks the compiler options to determine whether lazy compilation is enabled.
Rsbuild users can enable lazy compilation in two ways:
dev.lazyCompilation
optionexperiments.lazyCompilation
option (see the added test case)Checklist