diff --git a/packages/next-swc/crates/next-api/src/app.rs b/packages/next-swc/crates/next-api/src/app.rs index f3f706f96a779..f1c34c9425a9d 100644 --- a/packages/next-swc/crates/next-api/src/app.rs +++ b/packages/next-swc/crates/next-api/src/app.rs @@ -865,6 +865,7 @@ impl AppEndpoint { async move { Ok(node_root_value .get_path_to(&*file.ident().path().await?) + .filter(|path| path.ends_with(".js")) .map(|path| path.to_string())) } } @@ -882,6 +883,7 @@ impl AppEndpoint { async move { Ok(node_root_value .get_path_to(&*file.ident().path().await?) + .filter(|path| path.ends_with(".js")) .map(|path| path.to_string())) } }) diff --git a/packages/next-swc/crates/next-core/src/next_manifests/client_reference_manifest.rs b/packages/next-swc/crates/next-core/src/next_manifests/client_reference_manifest.rs index 6b8e7fbbafce9..3796558dba3e9 100644 --- a/packages/next-swc/crates/next-core/src/next_manifests/client_reference_manifest.rs +++ b/packages/next-swc/crates/next-core/src/next_manifests/client_reference_manifest.rs @@ -160,6 +160,9 @@ impl ClientReferenceManifest { .iter() .filter_map(|chunk_path| client_relative_path.get_path_to(chunk_path)) .map(ToString::to_string) + // It's possible that a chunk also emits CSS files, that will + // be handled separatedly. + .filter(|path| path.ends_with(".js")) .collect::>(); let ssr_chunks_paths = ssr_chunks