wasm-tool / wasm-pack-plugin

webpack plugin for Rust
MIT License
312 stars 70 forks source link

Plugin doesn't respect webpack `watchOptions`? Spawns new compilation without canceling? #130

Open EndilWayfare opened 2 years ago

EndilWayfare commented 2 years ago

Every time a change is detected, a new compilation is started even if one is already running.

I'm using rust-analyzer in VS Code, so turning off aggressive auto-save also turns off error checking and linting. But with auto-save on, webpack also wants to rebuild the WASM every few keystrokes. I'm using pure Rust (with yew), so there's no funny business with JS framework interactions (a la NextJS SSR).

I tried using watchOptions.aggregateTimeout to debounce the watcher, but that only seems to apply to non-Rust files.

It would be awesome if the Rust compilation could be debounced, or at least if in-flight compilations could be cancelled so they're not competing for resources when I stop typing and there's like 5 of them. 😄 It's entirely possible that I'm just missing something and have misconfigured.

I'm using the latest wasm-pack-plugin@1.6.0 and the latest webpack 4

yeskiy commented 1 year ago

Hey! Please check rust-wasmpack-loader pacakge, it should fix your porblem.