Skip to content

Keep HMR working when the dev server runs from a worktree - #361

Merged
RBilly merged 1 commit into
mainfrom
maestro/light-apex-110
Sep 11, 2026
Merged

Keep HMR working when the dev server runs from a worktree#361
RBilly merged 1 commit into
mainfrom
maestro/light-apex-110

Conversation

@RBilly

@RBilly RBilly commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Why

Running bun run dev (or tauri: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:

ignored: (file) =>
  ["src-tauri", ".maestro"].includes(path.relative(projectRoot, file).split(path.sep)[0]),

A worktree now watches its own sources, and still ignores its own nested .maestro/ and src-tauri/ — so the original reason for the entry (a worktree checkout's index.html/tsconfig.json making Vite hard-reload the app mid-worktree-creation) still holds. Vite 8 accepts a function for server.watch.ignored (AnymatchMatcher), so this needs no new dependency.

Verified in a worktree dev server: editing src/App.tsx logs hmr 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 the vite.dev/config link are gone, and each remaining comment is 1-3 lines carrying only the non-obvious reason.

Release Notes:

  • N/A

🤖 Generated with Claude Code

`**/.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.
@RBilly
RBilly merged commit d8a1579 into main Sep 11, 2026
3 checks passed
@RBilly
RBilly deleted the maestro/light-apex-110 branch September 11, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant