<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ashok Ram</title>
    <description>The latest articles on DEV Community by Ashok Ram (@ashokramsi).</description>
    <link>https://dev.to/ashokramsi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4254457%2Fbce23660-fbe3-4910-883d-3faf53f4602e.jpg</url>
      <title>DEV Community: Ashok Ram</title>
      <link>https://dev.to/ashokramsi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ashokramsi"/>
    <language>en</language>
    <item>
      <title>One /* in .taurignore and tauri dev watched nothing</title>
      <dc:creator>Ashok Ram</dc:creator>
      <pubDate>Thu, 19 Nov 2026 20:46:16 +0000</pubDate>
      <link>https://dev.to/ashokramsi/one-in-taurignore-and-tauri-dev-watched-nothing-4cnb</link>
      <guid>https://dev.to/ashokramsi/one-in-taurignore-and-tauri-dev-watched-nothing-4cnb</guid>
      <description>&lt;p&gt;&lt;code&gt;tauri dev&lt;/code&gt; is one of those things you stop thinking about. You save a Rust file, it rebuilds, the app comes back. So when it quietly stops rebuilding, it takes a while to even notice.&lt;/p&gt;

&lt;p&gt;That's what &lt;a href="https://github.com/tauri-apps/tauri/issues/9163" rel="noopener noreferrer"&gt;issue #9163&lt;/a&gt; was about. It had been open since March 2024. The reporter wanted &lt;code&gt;tauri dev&lt;/code&gt; to watch only a few things, so they wrote their &lt;code&gt;.taurignore&lt;/code&gt; as an allow list. Trimmed a little (their file also kept &lt;code&gt;icons/&lt;/code&gt;), it looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*
!/*.toml
!/*.rs
!/src
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ignore everything at the top, then bring back the &lt;code&gt;.toml&lt;/code&gt; files, the &lt;code&gt;.rs&lt;/code&gt; files and &lt;code&gt;src/&lt;/code&gt;. Same file as a &lt;code&gt;.gitignore&lt;/code&gt;? Works fine. As a &lt;code&gt;.taurignore&lt;/code&gt;? &lt;code&gt;tauri dev&lt;/code&gt; stopped watching the app completely. Edit &lt;code&gt;src/main.rs&lt;/code&gt;, nothing happens.&lt;/p&gt;

&lt;p&gt;I picked it up, and the fix got merged in &lt;a href="https://github.com/tauri-apps/tauri/pull/16398" rel="noopener noreferrer"&gt;tauri-apps/tauri#16398&lt;/a&gt;. The fix that got merged is not the one I sent first, though, and that part is honestly the most useful bit of this story.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproducing it
&lt;/h2&gt;

&lt;p&gt;Tauri's repo has a tiny app in &lt;code&gt;bench/tests/helloworld&lt;/code&gt;. I dropped the &lt;code&gt;.taurignore&lt;/code&gt; into its &lt;code&gt;src-tauri&lt;/code&gt; folder and ran &lt;code&gt;tauri dev&lt;/code&gt;. The CLI prints every folder it's watching, and the app folder just wasn't in the list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it happened
&lt;/h2&gt;

&lt;p&gt;The dev watcher lives in &lt;code&gt;crates/tauri-cli/src/interface/rust.rs&lt;/code&gt;. Before my change it did roughly this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;watch_folders&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;ignore_matcher&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is_ignore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// watch every entry of `path`&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So before watching a folder, it asked the ignore matcher: is this folder itself ignored? For the app folder, that's the same folder the &lt;code&gt;.taurignore&lt;/code&gt; sits in.&lt;/p&gt;

&lt;p&gt;The matcher comes from the &lt;a href="https://crates.io/crates/ignore" rel="noopener noreferrer"&gt;&lt;code&gt;ignore&lt;/code&gt;&lt;/a&gt; crate (the one ripgrep uses). Patterns in an ignore file are relative to the file's own folder, so the crate strips that folder off the path before matching. Ask it about the folder itself and you're left with an empty path. And &lt;code&gt;/*&lt;/code&gt; matches the empty path too.&lt;/p&gt;

&lt;p&gt;So the app folder counted as ignored and got skipped. The &lt;code&gt;!/src&lt;/code&gt; lines never had a chance, because they bring back things &lt;em&gt;inside&lt;/em&gt; the folder, and the watcher never looked inside.&lt;/p&gt;

&lt;p&gt;Git doesn't have this problem because it never applies a &lt;code&gt;.gitignore&lt;/code&gt; to the folder the file lives in. Only to what's below it. That one difference was the whole bug.&lt;/p&gt;

&lt;h2&gt;
  
  
  My first fix
&lt;/h2&gt;

&lt;p&gt;Since git was the behaviour everyone expected, I copied it. In &lt;code&gt;IgnoreMatcher::is_ignore&lt;/code&gt;, skip an ignore file when the path you're asking about is that file's own folder. Everything inside the app matched exactly like before, and a &lt;code&gt;.taurignore&lt;/code&gt; in a parent folder could still ignore a child folder.&lt;/p&gt;

&lt;p&gt;I wrote the test first, using the &lt;code&gt;.taurignore&lt;/code&gt; above, and watched it fail on the old code. Then the fix, and the test passed. &lt;code&gt;tauri dev&lt;/code&gt; on the bench app showed the app folder in the "Watching … for changes" log again. Then I opened the PR.&lt;/p&gt;

&lt;h2&gt;
  
  
  The review
&lt;/h2&gt;

&lt;p&gt;Legend-Master from the Tauri team requested changes. His point was that negative patterns are tricky to support, and treating &lt;code&gt;/*&lt;/code&gt; at the root as a special case didn't really make sense. Then he asked whether we should just always watch the folders and filter the change events instead.&lt;/p&gt;

&lt;p&gt;He was right, and when I thought about it, it was a better way to see the problem. My fix answered "is this folder ignored?" more carefully. His idea was to stop asking that question about the watch folders at all. A watch folder is something you told Tauri to watch. The ignore rules are about what's &lt;em&gt;in&lt;/em&gt; it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix that got merged
&lt;/h2&gt;

&lt;p&gt;I reworked the PR around that. A new helper, &lt;code&gt;watch_targets&lt;/code&gt;, lists what to watch: every entry of every watch folder that isn't ignored.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;watch_targets&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;watch_folders&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;PathBuf&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Vec&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;PathBuf&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;RecursiveMode&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="kd"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;targets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;Vec&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;watch_folders&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;lookup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;file_type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;mode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;file_type&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is_dir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nc"&gt;RecursiveMode&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Recursive&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nc"&gt;RecursiveMode&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;NonRecursive&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;targets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;targets&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;lookup&lt;/code&gt; already existed. It walks one level of the folder with the &lt;code&gt;ignore&lt;/code&gt; crate's &lt;code&gt;WalkBuilder&lt;/code&gt;, set up to read &lt;code&gt;.taurignore&lt;/code&gt; (plus the watcher rules Tauri ships with), so ignored entries never come back from it. The walk also hands back the folder itself, which is what the &lt;code&gt;p != *path&lt;/code&gt; check skips.&lt;/p&gt;

&lt;p&gt;The watch loop then stops asking about the folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="c1"&gt;// logging lines left out&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;watch_targets&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;watch_folders&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;watcher&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;watch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change events are still filtered by &lt;code&gt;IgnoreMatcher::is_ignore&lt;/code&gt;, same as before, so touching an ignored file doesn't trigger a rebuild.&lt;/p&gt;

&lt;p&gt;Two tests cover it, both with the &lt;code&gt;.taurignore&lt;/code&gt; from the issue. The first, &lt;code&gt;watch_targets_watch_a_folder_whose_taurignore_matches_it&lt;/code&gt;, checks that the watched entries are exactly &lt;code&gt;Cargo.toml&lt;/code&gt; and &lt;code&gt;src&lt;/code&gt;. The second, &lt;code&gt;ignore_matcher_filters_events_under_a_root_wide_pattern&lt;/code&gt;, checks that the matcher the event loop uses keeps &lt;code&gt;src/&lt;/code&gt;, &lt;code&gt;src/main.rs&lt;/code&gt; and &lt;code&gt;Cargo.toml&lt;/code&gt;, and ignores &lt;code&gt;README.md&lt;/code&gt; and &lt;code&gt;assets/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And the real check: with that file, editing &lt;code&gt;README.md&lt;/code&gt; triggers no rebuild, and editing &lt;code&gt;src/main.rs&lt;/code&gt; triggers one.&lt;/p&gt;

&lt;p&gt;Legend-Master approved it. He mentioned that from his experience with &lt;a href="https://github.com/parcel-bundler/watcher" rel="noopener noreferrer"&gt;parcel's watcher&lt;/a&gt; (the one VS Code uses), it seemed to watch the whole folder and match ignore patterns before events reach the app, and this change basically matches that. FabianLars approved too. It was merged on 12 November 2026 and shipped in &lt;code&gt;tauri-cli&lt;/code&gt; and &lt;code&gt;@tauri-apps/cli&lt;/code&gt; 2.12.5.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'm keeping from this one
&lt;/h2&gt;

&lt;p&gt;The reporter's file was the best test fixture I could have asked for. I barely changed it.&lt;/p&gt;

&lt;p&gt;When something works as a &lt;code&gt;.gitignore&lt;/code&gt; and not as your file, ask what git does differently. That question is what pointed me at the root folder.&lt;/p&gt;

&lt;p&gt;And the big one for me: my first fix passed its tests, but it added a special case. The maintainer's version deleted the question that caused the bug, and the code got simpler. I'll take that trade every time.&lt;/p&gt;

&lt;p&gt;Thanks Legend-Master and FabianLars for the reviews. If you've hit this before, or you do file watching differently in your project, I'd really like to hear how. Drop a comment.&lt;/p&gt;

</description>
      <category>rust</category>
      <category>tauri</category>
      <category>opensource</category>
      <category>debugging</category>
    </item>
  </channel>
</rss>
