tauri-apps/tauri

[bug] npm run tauri dev causes 'Rebuilding application...' loop

Closed this issue · 3 comments

Describe the bug

While working on my app and developing on ios (simulator) everything was working pretty well. Then I tried to start the desktop app again with npm run tauri dev. Sadly this is when it started going into an infinite rebuild loop.

In the output you can see it is watching src-tauri (twice) and the root folder. This is not happening when running the ios build and when I disable watching npm run tauri dev -- --no-watch it is also actually disabled.

the .gitignore files correctly list target etc. Where is the blocklist for watching coming from ? Why is it triggered here ? And why is it not triggered for iOS builds ?

❯ npm run tauri dev

> user-interface@0.1.0 tauri
> tauri dev

    Running BeforeDevCommand (`npm run dev`)

> user-interface@0.1.0 dev
> vite


  VITE v5.4.8  ready in 380 ms

  ➜  Local:   http://127.0.0.1:1420/
    Info Watching /Users/mgt/Development/curasystems/dicom-import/src-tauri for changes...
    Info Watching /Users/mgt/Development/curasystems/dicom-import for changes...
    Info Watching /Users/mgt/Development/curasystems/dicom-import/src-tauri for changes...
   Compiling dicom-importer v0.1.0 (/Users/mgt/Development/curasystems/dicom-import/src-tauri)
    Info File src-tauri/target/debug/.fingerprint/dicom-importer-a66883c78ed9624f/bin-dicom-importer changed. Rebuilding application...                       
    Info File src-tauri/target/debug/build/anyhow-bbd73ddf9f9b27bc/build-script-build changed. Rebuilding application...
    Info File src-tauri/target/debug/incremental/importer-1xwld1j3t4iu2/s-h0aq01knp2-1xb1egf-working/2i3byrrmel7eyfp5szsrgnfv0.o changed. Rebuilding application...
    Info File src-tauri/target/debug/build/unicase-04918ecfa4e43a43/build-script-build changed. Rebuilding application...

Reproduction

This is pretty hard to do (right now I would just like to know how to debug this. RUST_LOG=trace is not working

Expected behavior

To compile without going in a basically infinite change loop

Full tauri info output

[✔] Environment
    - OS: Mac OS 15.0.0 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ 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-aarch64-apple-darwin (default)
    - node: 16.20.2
    - npm: 8.19.4

[-] Packages
    - tauri 🦀: 2.0.0-rc.15
    - tauri-build 🦀: 2.0.0-rc.12
    - wry 🦀: 0.43.1
    - tao 🦀: 0.30.2
    - tauri-cli 🦀: 1.6.2
    - @tauri-apps/api : 2.0.0-rc.5
    - @tauri-apps/cli : 2.0.0-rc.16

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.0-rc.3
    - @tauri-apps/plugin-shell : 2.0.0-rc.1

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

[-] iOS
    - Developer Teams: xxx

Stack trace

No response

Additional context

No response

hmm, that's weird, afaik ios dev and macos dev use the same watcher impl here 🤔
Does this happen with a fresh create-tauri-app project too?

This is pretty hard to do (right now I would just like to know how to debug this. RUST_LOG=trace is not working

What about npm run tauri dev -- --verbose ?

I wasnt able to reproduce it yet. I am just confused why it even prints what it prints about "watching"

As in with a small project. But i didn't change anything with those tauri files

I found the mistake, in case someone has the same issue.

The project is part of a workspace and the members in the root Cargo.toml where incorrectly set to [".", ".src-tauri"]

The reason it was configured as a workspace,was the fact that the rust-analyzer plugin in vscode/cursor would not find the cargo.toml if it was nested and that caused friction when trying to develop both.

Event with the correction tauri watches "src-tauri" twice, but this does not end in a loop.