rspack: [Bug]: warning `failed to get stats` with lazyCompilation in dev mode

System Info

Image

Details

when i use rsbuild v1.0.19 with lazyCompilation mode.

the browser will show hmr connect and reload, and wait compilation done

But in v1.1.4 the browser will remain on the white page unless you refresh the page manually. it’s a bad dev experience

Reproduce link

No response

Reproduce Steps

export default defineConfig({
  dev: {
    progressBar: true,
    lazyCompilation: true
  },
})
rsbuild dev

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 29 (11 by maintainers)

Most upvoted comments

This warning has been removed, please try the latest version, if you still have the same issue, I’ll reopen this

Finally, thank you for your patience, I think this question seems like it could be lowered a bit in priority

Don’t worry, it’s our issue in the first place, and improving the stabelility of lazy compilation is good for us.

maybe you can provide me with some ideas to explore it?

I’m looking into this when I’m available, but if you have interest to help:

The lazy compilation arch is simple, there are client(your browser) and host(dev server). When bundling

compile start
|
v
found entry `main`
|
v
is `main` entry or dyn imported ? (yes)
|
v
proxy module `main`
and rewrite its content like
code:
---
notifyServerToRebuild(`main`)
---
|
v
Server gets notified, and inform the compiler to rebuild

This build we know that `main` is activated, it will change the content of original proxy module `main` to something like

code:
---
require('main') // imports real main module
---

Source code

How to replace the module with proxy module How proxy module works How to notify the compiler to rebuild

https://github.com/user-attachments/assets/b2e6603a-e84c-4004-8ceb-e26e15254d4b

commit: 47d9700a36dbfa4ca7fbfab48569931928f66280

BTW, I override @rspack/core to the latest commit, you can try if you can repro in the nightly version

Not at present, I’ll look into this later

Can you provide a minimal repro ? If so I can fix this in maybe several days