@@ -48,7 +48,7 @@ use serde_json::json;
4848use sugar_path:: SugarPath ;
4949
5050static NEXT_DIST_ESM_REGEX : Lazy < Regex > =
51- Lazy :: new ( || Regex :: new ( "[\\ /]next[\\ /]dist[\\ /]esm[\\ /]" ) . unwrap ( ) ) ;
51+ Lazy :: new ( || Regex :: new ( r "[\\/]next[\\/]dist[\\/]esm[\\/]") . unwrap ( ) ) ;
5252
5353static NEXT_DIST : Lazy < String > = Lazy :: new ( || {
5454 format ! (
@@ -1166,7 +1166,16 @@ impl FlightClientEntryPlugin {
11661166 } )
11671167 . chain ( add_action_entry_list. into_iter ( ) )
11681168 . collect :: < Vec < _ > > ( ) ;
1169+ let included_deps: Vec < _ > = args. iter ( ) . map ( |( dep, _) | * dep. id ( ) ) . collect ( ) ;
11691170 compilation. add_include ( args) . await ?;
1171+ for dep in included_deps {
1172+ let mut mg = compilation. get_module_graph_mut ( ) ;
1173+ let Some ( m) = mg. get_module_by_dependency_id ( & dep) else {
1174+ continue ;
1175+ } ;
1176+ let info = mg. get_exports_info ( & m. identifier ( ) ) ;
1177+ info. set_used_in_unknown_way ( & mut mg, Some ( & self . webpack_runtime ) ) ;
1178+ }
11701179
11711180 let mut added_client_action_entry_list: Vec < InjectedActionEntry > = Vec :: new ( ) ;
11721181 let mut action_maps_per_client_entry: HashMap < String , HashMap < String , Vec < ActionIdNamePair > > > =
@@ -1228,9 +1237,21 @@ impl FlightClientEntryPlugin {
12281237 . map ( |injected| added_client_action_entry_list. push ( injected) ) ;
12291238 }
12301239 }
1240+ let included_deps: Vec < _ > = added_client_action_entry_list
1241+ . iter ( )
1242+ . map ( |( dep, _) | * dep. id ( ) )
1243+ . collect ( ) ;
12311244 compilation
12321245 . add_include ( added_client_action_entry_list)
12331246 . await ?;
1247+ for dep in included_deps {
1248+ let mut mg = compilation. get_module_graph_mut ( ) ;
1249+ let Some ( m) = mg. get_module_by_dependency_id ( & dep) else {
1250+ continue ;
1251+ } ;
1252+ let info = mg. get_exports_info ( & m. identifier ( ) ) ;
1253+ info. set_used_in_unknown_way ( & mut mg, Some ( & self . webpack_runtime ) ) ;
1254+ }
12341255 Ok ( ( ) )
12351256 }
12361257
@@ -1464,10 +1485,7 @@ async fn after_emit(&self, compilation: &mut Compilation) -> Result<()> {
14641485 }
14651486 }
14661487 }
1467- if mod_resource. contains ( "app/style.css" ) {
1468- dbg ! ( module. get_layer( ) ) ;
1469- dbg ! ( module. identifier( ) ) ;
1470- }
1488+
14711489 if module. get_layer ( ) . map ( |layer| layer. as_str ( ) )
14721490 != Some ( WEBPACK_LAYERS . server_side_rendering )
14731491 {
@@ -1522,11 +1540,7 @@ async fn after_emit(&self, compilation: &mut Compilation) -> Result<()> {
15221540 && let Some ( module) = module. as_concatenated_module ( )
15231541 {
15241542 for m in module. get_modules ( ) {
1525- if let Some ( module_id) =
1526- ChunkGraph :: get_module_id ( & compilation. module_ids_artifact , m. id )
1527- {
1528- record_module ( module_id, & m. id ) ;
1529- }
1543+ record_module ( module_id, & m. id ) ;
15301544 }
15311545 }
15321546 }
0 commit comments