From 6b763552f1814dc90362e6b04bd671c2a20d7714 Mon Sep 17 00:00:00 2001 From: fireairforce <1344492820@qq.com> Date: Thu, 15 Jan 2026 00:26:04 +0800 Subject: [PATCH 1/3] fix(pack): add node_modules to watch ignore options --- crates/pack-api/src/project.rs | 17 +++++++++++++++-- crates/pack-napi/src/pack_api/project.rs | 10 ++++++++++ crates/pack-schema/src/lib.rs | 5 +++++ next.js | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/crates/pack-api/src/project.rs b/crates/pack-api/src/project.rs index 629261d44..f90a827bd 100644 --- a/crates/pack-api/src/project.rs +++ b/crates/pack-api/src/project.rs @@ -82,6 +82,15 @@ pub struct WatchOptions { /// Enable polling at a certain interval if the native file watching doesn't work (e.g. /// docker). pub poll_interval: Option, + + /// Paths to ignore when watching for file changes. + /// By default, ignores: node_modules + #[serde(default = "default_ignored_paths")] + pub ignored: Vec, +} + +fn default_ignored_paths() -> Vec { + vec!["node_modules".into()] } #[turbo_tasks::value] @@ -588,16 +597,20 @@ impl Project { } } - if denied_paths.is_empty() { + // Get watched ignored paths from configuration + let watched_ignored = self.watch.ignored.clone(); + + if denied_paths.is_empty() && watched_ignored.is_empty() { Ok(DiskFileSystem::new( PROJECT_FILESYSTEM_NAME.into(), self.root_path.clone(), )) } else { - Ok(DiskFileSystem::new_with_denied_paths( + Ok(DiskFileSystem::new_with_watched_ignored( PROJECT_FILESYSTEM_NAME.into(), self.root_path.clone(), denied_paths, + watched_ignored, )) } } diff --git a/crates/pack-napi/src/pack_api/project.rs b/crates/pack-napi/src/pack_api/project.rs index f2857e463..6a180bbb1 100644 --- a/crates/pack-napi/src/pack_api/project.rs +++ b/crates/pack-napi/src/pack_api/project.rs @@ -82,6 +82,10 @@ pub struct NapiWatchOptions { /// Enable polling at a certain interval if the native file watching doesn't work (e.g. /// docker). pub poll_interval_ms: Option, + + /// Paths to ignore when watching for file changes. + /// By default, ignores: node_modules + pub ignored: Option>, } #[napi(object)] @@ -178,6 +182,12 @@ impl From for WatchOptions { .poll_interval_ms .filter(|interval| !interval.is_nan() && interval.is_finite() && *interval > 0.0) .map(|interval| Duration::from_secs_f64(interval / 1000.0)), + ignored: val + .ignored + .unwrap_or_else(|| vec!["node_modules".to_string()]) + .into_iter() + .map(|s| s.into()) + .collect(), } } } diff --git a/crates/pack-schema/src/lib.rs b/crates/pack-schema/src/lib.rs index d7156d7b1..e8e9d9631 100644 --- a/crates/pack-schema/src/lib.rs +++ b/crates/pack-schema/src/lib.rs @@ -140,6 +140,11 @@ pub struct SchemaWatchOptions { /// Enable polling at a certain interval if the native file watching doesn't work (e.g. docker). #[serde(skip_serializing_if = "Option::is_none")] pub poll_interval: Option, + + /// Paths to ignore when watching for file changes. + /// By default, ignores: node_modules + #[serde(skip_serializing_if = "Option::is_none")] + pub ignored: Option>, } /// Environment variables for build-time injection diff --git a/next.js b/next.js index d78a3ebe0..a34b08391 160000 --- a/next.js +++ b/next.js @@ -1 +1 @@ -Subproject commit d78a3ebe0303e536179fc9ff497535a27bec4c90 +Subproject commit a34b083918dc598eb10eb79b688c295a1b781214 From 61494fe25dae1c2964e80fe3bd436748c0466ecd Mon Sep 17 00:00:00 2001 From: fireairforce <1344492820@qq.com> Date: Thu, 15 Jan 2026 21:20:42 +0800 Subject: [PATCH 2/3] chore: update review --- crates/pack-api/src/project.rs | 2 +- crates/pack-napi/src/pack_api/project.rs | 6 ++---- next.js | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/pack-api/src/project.rs b/crates/pack-api/src/project.rs index f90a827bd..f81409de0 100644 --- a/crates/pack-api/src/project.rs +++ b/crates/pack-api/src/project.rs @@ -89,7 +89,7 @@ pub struct WatchOptions { pub ignored: Vec, } -fn default_ignored_paths() -> Vec { +pub fn default_ignored_paths() -> Vec { vec!["node_modules".into()] } diff --git a/crates/pack-napi/src/pack_api/project.rs b/crates/pack-napi/src/pack_api/project.rs index 6a180bbb1..96ea57188 100644 --- a/crates/pack-napi/src/pack_api/project.rs +++ b/crates/pack-napi/src/pack_api/project.rs @@ -184,10 +184,8 @@ impl From for WatchOptions { .map(|interval| Duration::from_secs_f64(interval / 1000.0)), ignored: val .ignored - .unwrap_or_else(|| vec!["node_modules".to_string()]) - .into_iter() - .map(|s| s.into()) - .collect(), + .map(|v| v.into_iter().map(|s| s.into()).collect()) + .unwrap_or_else(pack_api::project::default_ignored_paths), } } } diff --git a/next.js b/next.js index a34b08391..eaa6d4cb6 160000 --- a/next.js +++ b/next.js @@ -1 +1 @@ -Subproject commit a34b083918dc598eb10eb79b688c295a1b781214 +Subproject commit eaa6d4cb65d635448c1f5cfff6a51d4449beaf3f From efcd73dd64e6b6ee2756bff92b076209123209e7 Mon Sep 17 00:00:00 2001 From: fireairforce <1344492820@qq.com> Date: Fri, 16 Jan 2026 00:22:32 +0800 Subject: [PATCH 3/3] chore: update napi files --- packages/pack/src/binding.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/pack/src/binding.d.ts b/packages/pack/src/binding.d.ts index 53142dc70..59d49efca 100644 --- a/packages/pack/src/binding.d.ts +++ b/packages/pack/src/binding.d.ts @@ -57,6 +57,11 @@ export interface NapiWatchOptions { * docker). */ pollIntervalMs?: number + /** + * Paths to ignore when watching for file changes. + * By default, ignores: node_modules + */ + ignored?: Array } export interface NapiProjectOptions { /**