Repository: tauri
Issue: [bug] `cargo tauri dev` fails if backend has dependency that can not compile to `wasm32-unknown-unknown`
Labels: type: bug,status: needs triage

### Describe the bug

 `cargo tauri dev` fails if the backend (i.e. `src-tauri`) crate has dependency that can not compile to `wasm32-unknown-unknown`. This results in errors such as
1. [`vswhom`: `C1056: cannot update the time date stamp field`](https://github.com/nabijaczleweli/vswhom-sys.rs/issues/2)
2.  `clang`: `Failed to find tool. Is clang++ installed?`
This only seems to occur when the frontend is Rust based, and so needs to compile to `wasm32-unknown-unknown`.
3. `cl.exe`: `ToolExecError: Command "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX64\\x64\\cl.exe" ...  with args cl.exe did not execute successfully`

From what I have gathered, it occurs when the `beforeDevCommand` or `beforeBuildCommand` in `tarui.conf.json` try to build the frontend.
e.g.
```json
"build": {
  "beforeDevCommand": "trunk serve",
  "beforeBuildCommand": "trunk build"
}
```
[Removing these commands](https://github.com/nabijaczleweli/vswhom-sys.rs/issues/2#issuecomment-2335172634) allows the crate to build, but obviously won't rebuild the frontend. However, adding them back in after does not result in the error, although this can be flakey.

I believe this is occurring because when the frontend builds, it is also building the backend dependencies. However, the frontend is trying to compile to a `wasm32-unknown-unknown` target, which the backend dependencies are not compatible with.

### Reproduction

1. Create a new Tauri app with a **Rust based frontend**. I've been using `cargo crate-tauri-app --rc`.
2. Add a non-`wasm32-unknown-unknown` compatible dependency to the backend `src-tauri` crate. I've been using [`zmq`](https://github.com/erickt/rust-zmq).
3. Build the app with `cargo tauri dev`, one of the errors above may occur, although this can be flakey.

To resolve:
4. Remove `"build": { "beforeDevCommand": "trunk serve" }` from `tauri.conf.json`.
5. Run `cargo tauri dev` again. This should build successfully, however will serve an old version of the app, if it exists.
6. Add `"build": { "beforeDevCommand": "trunk serve" }` back into `tauri.conf.json`.
7. Run `cargo tauri dev` again, which may now work successfully, however this can be flakey.

### Expected behavior

`cargo tauri dev` should succeed even if the backend (`src-tauri`) crate has non-`wasm32-unknown-unknown` compatible dependencies.

### Full `tauri info` output

```text
[✔] Environment
    - OS: Windows 10.0.22631 x86_64 (X64)
    ✔ WebView2: 128.0.2739.67
    ✔ MSVC: Visual Studio Build Tools 2022
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 18.17.1
    - pnpm: 8.7.0
    - npm: 10.8.3

[-] Packages
    - tauri 🦀: 2.0.0-rc.10
    - tauri-build 🦀: 2.0.0-rc.9
    - wry 🦀: 0.43.1
    - tao 🦀: 0.30.0
    - tauri-cli 🦀: 2.0.0-rc.8

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.0-rc.3

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
```


### Stack trace

_No response_

### Additional context

See also
1. [This Discord discussion](https://discord.com/channels/616186924390023171/1269170486823096374)
2. [`vswhom-sys` issue](https://github.com/nabijaczleweli/vswhom-sys.rs/issues/2)