-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable watch root #9424
Configurable watch root #9424
Conversation
@@ -389,7 +389,7 @@ export default class Parcel { | |||
let resolvedOptions = nullthrows(this.#resolvedOptions); | |||
let opts = getWatcherOptions(resolvedOptions); | |||
let sub = await resolvedOptions.inputFS.watch( | |||
resolvedOptions.projectRoot, | |||
resolvedOptions.watchDir, | |||
(err, events) => { | |||
if (err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably also update this so it works for one-shot builds
parcel/packages/core/core/src/RequestTracker.js
Line 1217 in e4f0a69
let events = await options.inputFS.getEventsSince( |
idk if watchRoot is the most obvious name in that case but not sure about another one. projectRoot is a different thing and affects more stuff so would need to be something different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Yeah the name because less intuitive when used in this context :|
related to: #4332
↪️ Pull Request
Adds a new
--watch-dir
CLI flag that allows users to specify a directory higher up than the project root. This allows Parcel in watch mode to detect changes to symlinked dependencies.This is especially useful for monorepos that have lockfiles for each of the projects and where all projects can't share the same project root for various reasons.
💻 Examples
Suppose we have a project shaped like this:
We can run
parcel server --watchDir ../..
from withinpackages/app
and changes topackages/lib/index.js
will trigger HMR updates, etc.🚨 Test instructions
I have included an integration test that exercises this new behavior. I confirmed that without the
watchDir
option Parcel won't detect changes but it does with the proper watch directory set.✔️ PR Todo