Keep HMR working when the dev server runs from a worktree - #361
Merged
Conversation
`**/.maestro/**` matched by substring on the absolute path, so a dev server started inside `.maestro/worktrees/<name>/` had that segment in every path it watched and chokidar ignored the entire checkout — no HMR at all. Match the path relative to this config file instead. A worktree now watches its own sources and still ignores its own nested `.maestro/` and `src-tauri/`. Also trims the config's comments to the non-obvious reasons only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Running
bun run dev(ortauri:dev) from inside a Maestro-created worktree gave no HMR at all — every edit required a manual reload.The cause is the watcher ignore list.
**/.maestro/**is matched by substring against the absolute path chokidar reports, and a worktree lives at<repo>/.maestro/worktrees/<name>/. So for a dev server started there, every file it watches contains.maestro/and the entire checkout was ignored.What
Match the path relative to this config file instead of using a floating glob:
A worktree now watches its own sources, and still ignores its own nested
.maestro/andsrc-tauri/— so the original reason for the entry (a worktree checkout'sindex.html/tsconfig.jsonmaking Vite hard-reload the app mid-worktree-creation) still holds. Vite 8 accepts a function forserver.watch.ignored(AnymatchMatcher), so this needs no new dependency.Verified in a worktree dev server: editing
src/App.tsxlogshmr update /src/App.tsx, while creating a file under.maestro/worktrees/triggers nothing.Also trims the comments in
vite.config.ts— the Tauri template's numbered list and thevite.dev/configlink are gone, and each remaining comment is 1-3 lines carrying only the non-obvious reason.Release Notes:
🤖 Generated with Claude Code