Skip to content

[feat] Add .taurignore and turn off the default behavior of watching all workspace members #4617

@simonhyll

Description

@simonhyll

Describe the problem

I use a monolithic style repository. Crates in my repository can be completely unrelated to the Tauri app, such as the REST API. But even if it's related to the app, for example the frontend resides in a separate workspace member than the Tauri source code. The result of watching all workspace members then is that rather than having hot reloading for my frontend, any change to the frontend results in the Tauri app being rebuilt as well. If I update the API, Tauri rebuilds, for absolutely no good reason. Even if I just change the README in another project, it triggers a rebuild of the Tauri app.

The only solution right now for me that sort of works is by passing an ignore file as an environment variable in the format of TAURI_DEV_WATCHER_IGNORE_FILE=.taurignore. It works, but passing that environment variable is incredibly annoying.

Describe the solution you'd like

  • Disable watching all workspace members by default. Add a CLI flag such as --watch-members to enable it. It's a good feature but I highly doubt most people using workspaces are using every single crate in their workspace for the Tauri project. If you disagree, at least add the reverse option, e.g. --no-watch-members
  • Support reading files in the workspace called .taurignore that disable watchers for ignored files

Alternatives considered

None really. I'll use my workaround until either of the above solutions are implemented, or until someone else suggests something better.

One potential improvement to the watched files could be only watching for changes in *.rs files in other workspace members, since it's pretty much guaranteed that the only reason you want to rebuild your Tauri app based on a workspace member change is when you've updated the Rust code. Icons and such most likely reside in the Tauri project itself so watching the entire Tauri project makes sense, but watching all files in all workspace members is almost guaranteed to be unnecessary and unwanted behavior, watching all Rust files should be the only thing people really need. Ignore files would still be required because again, if I have a REST API, I don't want those Rust source files to rebuild my Tauri app as well, but it'd be a start.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: 2 mediumE.g. DX regressions, bugs, dev crashes, etc...scope: cliThe tauri-cli rust crate and @tauri-apps/cli npm packagetype: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions