Skip to content

Turbopack: leave chunks in rscModuleMapping empty #79511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crates/next-api/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,6 @@ impl AppEndpoint {
entry_name: app_entry.original_name.clone(),
client_references,
client_references_chunks,
rsc_app_entry_chunks: app_entry_chunks,
client_chunking_context,
ssr_chunking_context,
async_module_info: module_graphs.full.async_module_info().to_resolved().await?,
Expand Down
39 changes: 5 additions & 34 deletions crates/next-core/src/next_manifests/client_reference_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use turbopack_core::{
asset::{Asset, AssetContent},
chunk::{ChunkingContext, ModuleChunkItemIdExt, ModuleId as TurbopackModuleId},
module_graph::async_module_info::AsyncModulesInfo,
output::{OutputAsset, OutputAssets},
output::OutputAsset,
virtual_output::VirtualOutputAsset,
};
use turbopack_ecmascript::utils::StringifyJs;
Expand All @@ -37,7 +37,6 @@ pub struct ClientReferenceManifestOptions {
pub entry_name: RcStr,
pub client_references: ResolvedVc<ClientReferenceGraphResult>,
pub client_references_chunks: ResolvedVc<ClientReferencesChunks>,
pub rsc_app_entry_chunks: ResolvedVc<OutputAssets>,
pub client_chunking_context: ResolvedVc<Box<dyn ChunkingContext>>,
pub ssr_chunking_context: Option<ResolvedVc<Box<dyn ChunkingContext>>>,
pub async_module_info: ResolvedVc<AsyncModulesInfo>,
Expand All @@ -58,7 +57,6 @@ impl ClientReferenceManifest {
entry_name,
client_references,
client_references_chunks,
rsc_app_entry_chunks,
client_chunking_context,
ssr_chunking_context,
async_module_info,
Expand Down Expand Up @@ -100,7 +98,6 @@ impl ClientReferenceManifest {
} = &*client_references_chunks.await?;
let client_relative_path = &*client_relative_path.await?;
let node_root_ref = &*node_root.await?;
let rsc_app_entry_chunks = &*rsc_app_entry_chunks.await?;

let client_references_ecmascript = client_references
.await?
Expand Down Expand Up @@ -167,10 +164,6 @@ impl ClientReferenceManifest {
ResolvedVc<Box<dyn OutputAsset>>,
ReadRef<FileSystemPath>,
> = FxHashMap::default();
let mut rsc_chunk_path_cache: FxHashMap<
ResolvedVc<Box<dyn OutputAsset>>,
ReadRef<FileSystemPath>,
> = FxHashMap::default();

for (client_reference_module, client_reference_module_ref) in
client_references_ecmascript
Expand Down Expand Up @@ -266,32 +259,10 @@ impl ClientReferenceManifest {
(Vec::new(), false)
};

let (rsc_chunks_paths, rsc_is_async) = if runtime == NextRuntime::Edge {
// the chunks get added to the middleware-manifest.json instead
// of this file because the
// edge runtime doesn't support dynamically
// loading chunks.
(Vec::new(), false)
let rsc_is_async = if runtime == NextRuntime::Edge {
false
} else {
let rsc_chunks_paths = cached_chunk_paths(
&mut rsc_chunk_path_cache,
rsc_app_entry_chunks.iter().copied(),
)
.await?;

let chunk_paths = rsc_chunks_paths
.filter_map(|(_, chunk_path)| {
node_root_ref
.get_path_to(&chunk_path)
.map(ToString::to_string)
})
.map(RcStr::from)
.collect::<Vec<_>>();

let is_async =
async_modules.contains(&ResolvedVc::upcast(client_reference_module));

(chunk_paths, is_async)
async_modules.contains(&ResolvedVc::upcast(client_reference_module))
};

entry_manifest.client_modules.module_exports.insert(
Expand Down Expand Up @@ -326,7 +297,7 @@ impl ClientReferenceManifest {
ManifestNodeEntry {
name: "*".into(),
id: (&*rsc_chunk_item_id).into(),
chunks: rsc_chunks_paths,
chunks: vec![],
r#async: rsc_is_async,
},
);
Expand Down
Loading