@@ -37,6 +37,9 @@ pub struct EvalSourceMapDevToolPlugin {
3737 debug_ids : bool ,
3838 ignore_list : Option < AssetConditions > ,
3939
40+ test : Option < AssetConditions > ,
41+ include : Option < AssetConditions > ,
42+ exclude : Option < AssetConditions > ,
4043 // TODO: memory leak if not clear across multiple compilations
4144 cache : DashMap < RspackHashDigest , BoxSource > ,
4245}
@@ -60,9 +63,31 @@ impl EvalSourceMapDevToolPlugin {
6063 options. source_root ,
6164 options. debug_ids ,
6265 options. ignore_list ,
66+ options. test ,
67+ options. include ,
68+ options. exclude ,
6369 Default :: default ( ) ,
6470 )
6571 }
72+
73+ fn match_object ( & self , str : & str ) -> bool {
74+ if let Some ( condition) = & self . test
75+ && !condition. try_match ( str)
76+ {
77+ return false ;
78+ }
79+ if let Some ( condition) = & self . include
80+ && !condition. try_match ( str)
81+ {
82+ return false ;
83+ }
84+ if let Some ( condition) = & self . exclude
85+ && condition. try_match ( str)
86+ {
87+ return false ;
88+ }
89+ true
90+ }
6691}
6792
6893#[ plugin_hook( CompilerCompilation for EvalSourceMapDevToolPlugin ) ]
@@ -99,6 +124,23 @@ async fn render_module_content(
99124 . get_hash ( & module. identifier ( ) , Some ( chunk. runtime ( ) ) )
100125 . expect ( "should have codegen results hash in process assets" ) ;
101126
127+ if module
128+ . as_normal_module ( )
129+ . is_some_and ( |m| !self . match_object ( m. resource_resolved_data ( ) . resource ( ) ) )
130+ {
131+ return Ok ( ( ) ) ;
132+ }
133+
134+ if module. as_concatenated_module ( ) . is_some_and ( |c| {
135+ let mg = compilation. get_module_graph ( ) ;
136+ let root_id = c. get_root ( ) ;
137+ mg. module_by_identifier ( & root_id)
138+ . and_then ( |m| m. as_normal_module ( ) )
139+ . is_some_and ( |m| !self . match_object ( m. resource_resolved_data ( ) . resource ( ) ) )
140+ } ) {
141+ return Ok ( ( ) ) ;
142+ }
143+
102144 let origin_source = render_source. source . clone ( ) ;
103145 if let Some ( cached_source) = self . cache . get ( module_hash) {
104146 render_source. source = cached_source. value ( ) . clone ( ) ;
0 commit comments