Repository navigation
fix(dev): skip watching static/ when it does not exist (#235) - #253
Open
10vulture1005 wants to merge 3 commits into
Open
10vulture1005 wants to merge 3 commits into
10vulture1005 wants to merge 3 commits into
Conversation
`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
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.
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.