@@ -1255,6 +1255,8 @@ pub struct BuildFastCheckTypeGraphOptions<'a> {
12551255
12561256pub struct BuildOptions < ' a > {
12571257 pub is_dynamic : bool ,
1258+ /// Skip loading statically analyzable dynamic dependencies.
1259+ pub skip_dynamic_deps : bool ,
12581260 /// Additional imports that should be brought into the scope of
12591261 /// the module graph to add to the graph's "imports". This may
12601262 /// be extra modules such as TypeScript's "types" option or JSX
@@ -1278,6 +1280,7 @@ impl Default for BuildOptions<'_> {
12781280 fn default ( ) -> Self {
12791281 Self {
12801282 is_dynamic : false ,
1283+ skip_dynamic_deps : false ,
12811284 imports : Default :: default ( ) ,
12821285 executor : Default :: default ( ) ,
12831286 locker : None ,
@@ -3606,6 +3609,7 @@ impl FillPassMode {
36063609
36073610struct Builder < ' a , ' graph > {
36083611 in_dynamic_branch : bool ,
3612+ skip_dynamic_deps : bool ,
36093613 was_dynamic_root : bool ,
36103614 file_system : & ' a FileSystem ,
36113615 jsr_url_provider : & ' a dyn JsrUrlProvider ,
@@ -3636,6 +3640,7 @@ impl<'a, 'graph> Builder<'a, 'graph> {
36363640 } ;
36373641 let mut builder = Self {
36383642 in_dynamic_branch : options. is_dynamic ,
3643+ skip_dynamic_deps : options. skip_dynamic_deps ,
36393644 was_dynamic_root : options. is_dynamic ,
36403645 file_system : options. file_system ,
36413646 jsr_url_provider : options. jsr_url_provider ,
@@ -5187,6 +5192,10 @@ impl<'a, 'graph> Builder<'a, 'graph> {
51875192 maybe_version_info : Option < & JsrPackageVersionInfoExt > ,
51885193 ) {
51895194 for dep in dependencies. values_mut ( ) {
5195+ if dep. is_dynamic && self . skip_dynamic_deps {
5196+ continue ;
5197+ }
5198+
51905199 if matches ! ( self . graph. graph_kind, GraphKind :: All | GraphKind :: CodeOnly )
51915200 || dep. maybe_type . is_none ( )
51925201 {
0 commit comments