Closed sirinsidiator closed 1 year ago
Following your repro instructions, I couldn't find anything unusual, create-tauri-app templates have been updated to use a newer version of vite, could you test again? if the issue persists, please upload the repro to GitHub and post the link here.
I just tried it again and it is still not working as expected. When I follow my steps and watch the process id for the vite node.js with Process Monitor, I get hundreds of thousands of events like this per second: As soon as I set src-tauri to be ignored in vite, it no longer does that.
I know this isn't really a bug in tauri and more of a configuration problem for a somewhat special use-case, but I figured I'd take the time and report it, since it is not trivial to find and fix when one hits this issue and I didn't find anything at all on the internet about this particular problem when I looked into it.
In my opinion the js side doesn't have any business watching the src-tauri folder anyway, so it wouldn't hurt to add that to templates that use vite regardless.
Describe the bug
When using the create-tauri-app utility, the vite dev command watches the whole project folder by default, which causes a weird interaction with cxx where it would continuously rescan the debug output folder inside the src-tauri folder. This causes a huge memory leak (5MB+/s) and makes the whole debug process slow down to a crawl. The rescanning can be easily observed with sysinternals procmon.
Ignoring the src-tauri folder in vite.config.ts fixes the problem entirely:
Reproduction
npm create tauri-app@latest
cargo add cxx
cargo add cxx-build --build
npm run tauri dev
and observe the node.js process for vite go crazy.Expected behavior
Vite should run normally and not leak memory.
Platform and versions
Stack trace
No response
Additional context
No response