Skip to content
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

[Bug]: When using a web worker with lazyCompilation enabled, a compilation error occurs. #7962

Closed
wendy0512 opened this issue Sep 24, 2024 · 4 comments · Fixed by #8273
Closed
Assignees

Comments

@wendy0512
Copy link

Version

System:
    OS: Windows 10 10.0.19042
    CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11500 @ 2.70GHz
    Memory: 12.17 GB / 31.71 GB
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (127.0.2651.74)  
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @rsbuild/core: ^1.0.4 => 1.0.4 
    @rsbuild/plugin-less: ^1.0.1 => 1.0.1 
    @rsbuild/plugin-react: ^1.0.2 => 1.0.2 
    @rsbuild/plugin-styled-components: ^1.0.1 => 1.0.1

Details

1.Create a worker example, as shown in the reproduction repository.
2.Enable dev: { lazyCompilation: true }, and open the page link. The following error appears in the compiler console:
image
3.If dev: { lazyCompilation: true } is disabled, the page runs normally, as shown below:
image

Reproduce link

https://github.com/wendy0512/rsbuild-worker-repro

Reproduce Steps

  1. npm i
  2. npm start
@9aoy 9aoy transferred this issue from web-infra-dev/rsbuild Sep 24, 2024
@wendy0512 wendy0512 changed the title [Bug]: When using a worker with lazyCompilation enabled, a compilation error occurs. [Bug]: When using a web worker with lazyCompilation enabled, a compilation error occurs. Oct 29, 2024
@wendy0512
Copy link
Author

wendy0512 commented Oct 29, 2024

As of version 1.014, I'm still encountering errors during runtime. Could you please help me look into this bug? @JSerFeng

@JSerFeng
Copy link
Contributor

JSerFeng commented Oct 30, 2024

Sorry for the delay, I checked the repro, turns out it was a HMR bug for both Rspack and webpack, I'm fixing it but it was tricky, I'm working on it

@JSerFeng
Copy link
Contributor

JSerFeng commented Oct 30, 2024

For the temporary solution is to disable splitChunks, you can achieve that by config like this

defineConfig({
  tools: { rspack(config) {config.optimization.splitChunks = false} }
})

@JSerFeng
Copy link
Contributor

JSerFeng commented Nov 1, 2024

You can try this version @rspack/[email protected], should be fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants