tauri: [bug] tauri cli rebuild dependencies every time I save file
Describe the bug
Every time I save file cargo check invoked from rust analyzer. then tauri trigger reload and recompile. However it recompile a lot of crates each time I save which takes a lot of time. maybe it has conflict with rust analyzer. It’s affect the development and it’s hard to develop when each time I save file it recompile for a minute.
Reproduction
bunx tauri dev in v2 project in vscode in macos with rust analyzer.
Expected behavior
If I didn’t changed anything, it shouldn’t rebuild anything.
Full tauri info output
bunx tauri info
[✔] Environment
- OS: Mac OS 14.5.0 X64
✔ Xcode Command Line Tools: installed
✔ rustc: 1.79.0 (129f3b996 2024-06-10)
✔ cargo: 1.79.0 (ffa9cf99a 2024-06-03)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-aarch64-apple-darwin (default)
- node: 20.15.1
- npm: 10.7.0
- bun: 1.1.18
[-] Packages
- tauri [RUST]: 2.0.0-rc.8
- tauri-build [RUST]: 2.0.0-rc.7
- wry [RUST]: 0.42.0
- tao [RUST]: 0.29.1
- @tauri-apps/api [NPM]: 2.0.0-rc.3
- @tauri-apps/cli [NPM]: 2.0.0-beta.23
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: React
- bundler: Vite
Stack trace
Comment too long to paste here
https://gist.github.com/thewh1teagle/cc78a89afe1d6496e41899bb6aab79b9
Additional context
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 11
- Comments: 15 (8 by maintainers)
I don’t know if this might help you, but my workaround is to run the Rust Analyzer separately from the tauri-cli. I use VSCode, where I point the Rust Analyzer to a different directory. It does result in duplicate file handling, but it temporarily solves my issues.
In my case, I use VSCode and apply the following setting. After that, the Rust Analyzer and the Tauri CLI build process no longer interfere with each other:
There is a workaround if you use VSCode.
I should note that on Windows, instead of
ring, it rebuildsvswhom-sysI ran into similar issues in the past, usually it’s a single dependency that has to re-compile. Here it seems to be
ring. I assume it’s due to a different environment triggering arebuild-if-env-changed.I ran into the issue with
ringspecifically just a few weeks ago too in another project. So to fix this issue withtauri, eitherringhas to be replaced as a sub-dependency (e.g. withopenssl), orringhas to be fixed.Could you share your project structure? generally tauri tries to reload only on relevant files changes but you can choose files to ignore by adding a
.taurignore(works similar to.gitignore) file in your project.