rspack
rspack copied to clipboard
[Bug]: devServer.headers are not added to experiments.lazyCompilation middlewar
System Info
System: OS: macOS 15.3.2 CPU: (12) arm64 Apple M2 Pro Memory: 391.30 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.12.1 - ~/.asdf/installs/nodejs/20.12.1/bin/node Yarn: 1.22.22 - /opt/homebrew/bin/yarn npm: 10.5.0 - ~/.asdf/installs/nodejs/20.12.1/bin/npm pnpm: 10.0.0 - ~/Library/pnpm/pnpm Browsers: Safari: 18.3.1 npmPackages: @rspack/cli: 1.3.5 => 1.3.5 @rspack/core: 1.3.5 => 1.3.5 @rspack/plugin-react-refresh: 1.2.1 => 1.2.1
Details
Hey, after upgrading Rspack to >1.3 and getting an error related to the Lazy Compilation
The issue I see is that the headers configured in devServer are not respected by the new LazyCompilationMiddleware. So when the lazy compilation server is configured to a different address than the app, it results in Cors errors.
Reproduce link
I'm not sure it's possible in this template
Reproduce Steps
- Configure server side rendered app and set cross origin config
- Set the lazyCompilation { serverUrl: http://localhost:3050 }
- Set the dev server:
devServer: { port: 3050, static: './public/assets', headers: { 'Access-Control-Allow-Origin': '*' }