-
-
Notifications
You must be signed in to change notification settings - Fork 781
Description
System Info
System:
OS: macOS 26.1
CPU: (16) arm64 Apple M4 Max
Memory: 248.64 MB / 48.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.17.1 - /usr/local/bin/node
npm: 11.6.3 - /usr/local/bin/npm
pnpm: 10.20.0 - /usr/local/bin/pnpm
Watchman: 2025.11.10.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 144.0.7559.133
Firefox: 147.0.3
Safari: 26.1
npmPackages:
@rspack/cli: ^1.7.0 => 1.7.6
@rspack/core: ^1.7.0 => 1.7.6
@rspack/dev-server: ^1.2.1 => 1.2.1
Details
Lazy compilation settings appear to not be applied when running development builds from the API (e.g. new RspackDevServer(options, compiler). I noticed this specifically with the MultiCompiler, but the same discrepancy exists with the standard single compiler. Invoking rspack dev for a development build properly respects lazy compilation settings.
Let me know if I should instead file this as a bug rspack-dev-server. I wasn't totally certain whether to file it here or there.
Reproduce link
https://github.com/cellison-figma/rspack-mutliCompiler-lazyCompilation
Reproduce Steps
For most clarity, the dev:{cli,api}:test scripts should be used, as they use lazyCompilation.test & log the decision made.
- run
pnpm dev:cli:test& note lazy compilation logic is used
> rspack dev -c rspack.config.test.mjs
[lazyCompilation test] EAGER: /path/to/rspack-mutliCompiler-lazyCompilation/src/index.js
[lazyCompilation test] LAZY: /path/to/rspack-mutliCompiler-lazyCompilation/src/render.js
[app1] asset emitted: index.html
[app1] asset emitted: src_render_js_lazy-compilation-proxy.js
[app1] asset emitted: main.js
[app1] compilation finished in 52 ms
- run
pnpm dev:api:test& note lazy compilation logic is not present and all assets are built
> node dev-server.test.mjs
[app1] asset emitted: src_render_js.js
[app1] asset emitted: index.html
[app1] asset emitted: src_render_js.css
[app1] asset emitted: main.js
[app1] compilation finished in 37 ms
Other scripts for completeness are described below
- run
pnpm dev:cli& notice that only the index HTML file and main.js are emitted initially - load
localhost:3000& see lazyCompilation work as expected to build remaining assets - run
pnpm dev:api& notice that CSS & render files are also built on initial build - load
localhost:3000& see that no additional assets are built
repeat with dev:cli:single and dev:api:single for single-compiler builds with the same results, respectively.