tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
81.61k stars 2.44k forks source link

[bug] `tauri dev` does not ignore Emacs autosave files #6616

Closed rome-user closed 1 year ago

rome-user commented 1 year ago

Describe the bug

When running tauri dev and editing a Rust file, say main.rs, Emacs will usually create backup files like .build.rs rather than editing a file directly. This seems to confuse Tauri and trigger a recompile (and restarting my app).

Reproduction

  1. Use any Tauri project template of your choice. I am personally using https://github.com/rome-user/tauri-clojurescript-template
  2. Run tauri dev
  3. Wait for build to complete and app to launch
  4. Within Emacs, open the Rust file that corresponds to the main entry point of the Tauri app (in my case, it is main.rs).
  5. Add anything to the file, like a comment.

Expected behavior

Autosave and backup files should not trigger any hot reloading facility. This problem does not exist with Shadow CLJS, Webpack HMR, etc.

Platform and versions

> tauri-app@5.11.11 tauri
> tauri info

Environment
  › OS: Mac OS 10.15.7 X64
  › Node.js: 18.15.0
  › npm: 9.6.2
  › pnpm: Not installed!
  › yarn: 1.22.19
  › rustup: Not installed!
  › rustc: 1.68.0
  › cargo: 1.68.0
  › Rust toolchain: 

Packages
  › @tauri-apps/cli [NPM]: 1.2.3
  › @tauri-apps/api [NPM]: 1.2.0
  › tauri [RUST]: 1.2.4,
  › tauri-build [RUST]: 1.2.1,
  › tao [RUST]: 0.15.8,
  › wry [RUST]: 0.23.4,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../public
  › devPath: http://localhost:1420/
  › framework: React

App directory structure
  ├─ node_modules
  ├─ public
  ├─ src-tauri
  ├─ dev
  ├─ .git
  ├─ assets
  └─ src

Stack trace

No response

Additional context

No response

FabianLars commented 1 year ago

You could create a .taurignore file next to tauri.conf.json, it has a syntax similar to .gitignore files so i went a bit over the top and added this

\#*
\#*#
.\#*
.\#*#

**/\#*
**/\#*#
**/.\#*
**/.\#*#

And it looks like it worked..

Btw, you can also completely disable the dev watcher with the --no-dev-watcher flag.

rome-user commented 1 year ago

This is good solution to the problem. I wasn't aware of .taurignore when reading the documentation

Thank you