trunk-rs / trunk

Build, bundle & ship your Rust WASM application to the web.
https://trunkrs.dev/
Apache License 2.0
3.53k stars 255 forks source link

Trunk fails on build when serve on windows #852

Open JurrianFahner opened 2 months ago

JurrianFahner commented 2 months ago

When following the yew starting guide it fails in the following way: image

Workaround is to run trunk build first and then the trunk serve command succeeds.

In my understanding the workaround shouldn't be applied.

Affected trunk versions:

ctron commented 2 months ago

True, I am wondering why you get an Access is denied error?

TheExistingOne commented 1 month ago

I am also encountering this issue using a fresh install of trunk 0.20.3 and cargo 1.81.0 when building a Bevy WASM project. The error didn't occur on macOS and I do have permissions to the directory.

Running trunk build before trunk serve resolves the error for me as well, although I don't have any idea why.

One thing I did find while playing around with it is that manually creating the directory "target/wasm32-unknown-unknown" also allows trunk serve to build. I'm wondering if there may be some difference in the way serve and build initialize directories that's causing strange behavior.

My HTML template and Trunk.toml look like this if that's helpful. ### HTML - wasmopt.html ```html ``` ### Trunk.toml ```toml # A sem-ver version requirement of trunk required for this project trunk-version = "*" [build] # The index HTML file to drive the bundling process. target = "wasmopt.html" # Build in release mode. release = true # The output dir for all final assets. dist = "out/wasmopt" [clean] # The output dir for all final assets. dist = "out/wasmopt" ```
JurrianFahner commented 3 weeks ago

True, I am wondering why you get an Access is denied error?

I don't have a clue. Also no experience yet with debugging trunk.