RReverser / wasm-bindgen-rayon

An adapter for enabling Rayon-based concurrency on the Web with WebAssembly.
https://docs.rs/wasm-bindgen-rayon
Apache License 2.0
117 stars 8 forks source link

Circular dependency problem with webpack #1

Closed noname0310 closed 6 months ago

noname0310 commented 6 months ago

warning message from my project:

WARNING in [entry] [initial]
Circular dependency between chunks with runtime (main, src_Runtime_Optimized_wasm_index_js-src_Runtime_Optimized_wasm_snippets_wasm-bindgen-rayon-3e-460835)
This prevents using hashes of each other and should be avoided.

webpack 5.89.0 compiled with 1 warning in 824 ms

Looking at the bundled code, it seems that the Circular dependency is formed in the order of pkg.js -> workerHelpers.js -> workerHelpers.worker.js -> pkg.js

This article looks like the same case: https://stackoverflow.com/questions/73157442/webpack-warning-using-webworker-circular-dependency-between-chunks-with-runtime

I also tried running the webpack tests inside the test directory of this repository and saw the same warnings:

WARNING in [entry]
Circular dependency between chunks with runtime (219, index)
This prevents using hashes of each other and should be avoided.

webpack 5.89.0 compiled with 1 warning in 209 ms

Is it safe to ignore this warning?

RReverser commented 6 months ago

Is it safe to ignore this warning?

Yes. For Wasm threads this sort of circular dependency between a Worker and the main JS is essential. It's a shame bundlers don't handle it better, but it's an old and well-known issue and for now can be only ignored.