rspack icon indicating copy to clipboard operation
rspack copied to clipboard

[Bug]: dev server error when hmr encounters a wasm package change.

Open brochington opened this issue 9 months ago • 3 comments

Version

System:
  OS: macOS 14.4.1
  CPU: (12) arm64 Apple M3 Pro
  Memory: 3.34 GB / 36.00 GB
  Shell: 5.9 - /bin/zsh
Browsers:
  Chrome: 124.0.6367.119
  Safari: 17.4.1

Details

I have a project that contains two packages, one which is a react app, and the other a wasm-pack based wasm library.

Everything works as expected when starting the Rsbuild dev server, but if I rebuild the wasm library, the dev compiler fails with the following console error:

start   Compiling...
ready   Client compiled in 0.14 s
start   Compiling...
ready   Client compiled in 0.01 s
start   Compiling...
error   Compile error: 
Failed to compile, check the errors for troubleshooting.
File: undefined
  × Conflict: Multiple assets emit different content to the same filename index.44be1698c47b3b8a.hot-update.js

start   Compiling...
error   Compile error: 
Failed to compile, check the errors for troubleshooting.
File: undefined
  × Conflict: Multiple assets emit different content to the same filename index.b0c9980bbdb8ffad.hot-update.js

I am unsure why the compiler runs twice as well.

I would like to be able to rebuild the wasm module, and have the hmr pick up the changed package and reload.

Reproduce link

https://github.com/brochington/mult-assets-rsbuild-repro

Reproduce Steps

# At project root

# build wasm bundle
$ npm run build:wasm

# make sure local deps are connected/symlinked
$ npm install 

# run client, start up rsbuild dev
$ npm run client:dev

# In a separate terminal, rebuild wasm

$ npm run build:wasm

brochington avatar May 07 '24 04:05 brochington

Rebuild multiple times is because wasm build triggers multiple file changes, and rspack's watchOptions.aggregateTimeout time interval is small. Multiple assets emit different content to the same filename This error seems to be a problem with the rspack code. I will transfer this issue to the rspack repo.

9aoy avatar May 07 '24 09:05 9aoy

Added a debug log for conflicting assets: image

original_source:

image

asset_source: image

9aoy avatar May 07 '24 09:05 9aoy

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] avatar Jul 06 '24 10:07 stale[bot]