Skip to content

fix(dev): skip watching static/ when it does not exist (#235) - #253

Open
10vulture1005 wants to merge 3 commits into
metacall:masterfrom
10vulture1005:fix/235-dev-missing-static-directory
Open

10vulture1005 wants to merge 3 commits into
metacall:masterfrom
10vulture1005:fix/235-dev-missing-static-directory

Conversation

@10vulture1005

Copy link
Copy Markdown
Contributor

the metassr dev crash when a project has no static/ dir. I looked at how Next.js handles the same thing (their public/ dir is optional too): they treat a missing directory as a completely valid state — their filesystem checker just catches ENOENT and moves on, and only re-throws real errors like permissions; on top of that they don't even watch public/ for HMR since static assets are served straight from disk per-request, so nothing depends on the dir existing at startup. So I followed that direction here: FileWatcher::watch_optional() now skips an absent path (and the notify PathNotFound race) instead of dying, dev just logs a warning and keeps going, and any real watcher error still fails loudly but now names the path in the message. Verified end-to-end in a container, old binary crashes with "No path was found.", new binary warns and serves the page, and with static/ present everything still works including assets.

10vulture1005 and others added 3 commits November 14, 2026 22:47
`metassr dev` exited with "No path was found." right after the first
build when the project had no `static/` directory. `setup_watcher()`
watched `static/` unconditionally and notify refuses to watch a path
that does not exist.

- skip the directories that do not exist instead of aborting the dev
  server, they are watched as soon as they are created
- watch the project root (non recursively) to detect the creation of the
  missing directories and upgrade the watch to a recursive one
- name the path in every watcher error, the previous message did not
  indicate which path was missing
- ignore the events that happen outside of the watched directories

Fixes metacall#235

This branch has not been deployed

No deployments
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