11use rspack_core:: {
2- CachedConstDependency , ConstDependency , NodeDirnameOption , NodeFilenameOption , NodeGlobalOption ,
3- RuntimeGlobals , RuntimeRequirementsDependency , get_context, parse_resource,
2+ CachedConstDependency , ConstDependency , ImportMeta , NodeDirnameOption , NodeFilenameOption ,
3+ NodeGlobalOption , RuntimeGlobals , RuntimeRequirementsDependency , get_context, parse_resource,
44} ;
55use rspack_error:: { Diagnostic , cyan, yellow} ;
66use rspack_util:: SpanExt ;
@@ -589,7 +589,10 @@ impl JavascriptParserPlugin for NodeStuffPlugin {
589589 return None ;
590590 }
591591 // Skip if importMeta is disabled
592- if parser. javascript_options . import_meta == Some ( false ) {
592+ if matches ! (
593+ parser. javascript_options. import_meta,
594+ Some ( ImportMeta :: None )
595+ ) {
593596 return None ;
594597 }
595598 // Skip if node: false or node.filename is disabled
@@ -625,7 +628,10 @@ impl JavascriptParserPlugin for NodeStuffPlugin {
625628 return None ;
626629 }
627630 // Skip if importMeta is disabled
628- if parser. javascript_options . import_meta == Some ( false ) {
631+ if matches ! (
632+ parser. javascript_options. import_meta,
633+ Some ( ImportMeta :: None )
634+ ) {
629635 return None ;
630636 }
631637 // Skip if node: false or node.dirname is disabled
@@ -660,7 +666,10 @@ impl JavascriptParserPlugin for NodeStuffPlugin {
660666 match for_name {
661667 expr_name:: IMPORT_META_FILENAME => {
662668 // Skip processing if importMeta is disabled
663- if parser. javascript_options . import_meta == Some ( false ) {
669+ if matches ! (
670+ parser. javascript_options. import_meta,
671+ Some ( ImportMeta :: None )
672+ ) {
664673 return None ;
665674 }
666675 // Skip processing if node: false or node.filename is disabled
@@ -681,7 +690,10 @@ impl JavascriptParserPlugin for NodeStuffPlugin {
681690 }
682691 expr_name:: IMPORT_META_DIRNAME => {
683692 // Skip processing if importMeta is disabled
684- if parser. javascript_options . import_meta == Some ( false ) {
693+ if matches ! (
694+ parser. javascript_options. import_meta,
695+ Some ( ImportMeta :: None )
696+ ) {
685697 return None ;
686698 }
687699 // Skip processing if node: false or node.dirname is disabled
@@ -762,7 +774,10 @@ impl JavascriptParserPlugin for NodeStuffPlugin {
762774 return None ;
763775 }
764776 // Skip processing if importMeta is disabled
765- if parser. javascript_options . import_meta == Some ( false ) {
777+ if matches ! (
778+ parser. javascript_options. import_meta,
779+ Some ( ImportMeta :: None )
780+ ) {
766781 return None ;
767782 }
768783 let property = if for_name == expr_name:: IMPORT_META_FILENAME {
@@ -797,7 +812,10 @@ impl JavascriptParserPlugin for NodeStuffPlugin {
797812 } ;
798813
799814 // Skip processing if importMeta is disabled
800- if parser. javascript_options . import_meta == Some ( false ) {
815+ if matches ! (
816+ parser. javascript_options. import_meta,
817+ Some ( ImportMeta :: None )
818+ ) {
801819 return None ;
802820 }
803821
@@ -820,7 +838,10 @@ impl JavascriptParserPlugin for NodeStuffPlugin {
820838 }
821839
822840 // Skip processing if importMeta is disabled
823- if parser. javascript_options . import_meta == Some ( false ) {
841+ if matches ! (
842+ parser. javascript_options. import_meta,
843+ Some ( ImportMeta :: None )
844+ ) {
824845 return None ;
825846 }
826847
0 commit comments