diff --git a/packages/host-watcher/src/parcel-watcher-backend.ts b/packages/host-watcher/src/parcel-watcher-backend.ts index 2d928d3d3..3cfe7f064 100644 --- a/packages/host-watcher/src/parcel-watcher-backend.ts +++ b/packages/host-watcher/src/parcel-watcher-backend.ts @@ -40,9 +40,13 @@ function createInProcessBackend(): ParcelWatcherBackend { return { async subscribe(dir, callback, opts) { // Lazy import keeps the native addon out of the parent unless we actually - // watch in-process. - const { realParcelWatcher } = await import("./real-parcel-watcher.js"); - return realParcelWatcher.subscribe(dir, callback, opts); + // watch in-process. Import the EXTERNAL package directly: a dynamic + // import of an internal module gets inlined by esbuild, and its static + // `import ... from "@parcel/watcher"` is then hoisted to the top of the + // daemon bundle, loading watcher.node into the parent at startup. + const { default: parcelWatcher }: { default: ParcelWatcherBackend } = + await import("@parcel/watcher"); + return parcelWatcher.subscribe(dir, callback, opts); }, }; }