From d2458e4ab1d3e1000cd838325d9b8fd96998d04b Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:52:21 +0100 Subject: [PATCH] Review comments: bail when dropping traced externals --- .../crates/turbopack-core/src/resolve/mod.rs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/turbopack/crates/turbopack-core/src/resolve/mod.rs b/turbopack/crates/turbopack-core/src/resolve/mod.rs index 1f4035f95fe841..52e753a8a2c983 100644 --- a/turbopack/crates/turbopack-core/src/resolve/mod.rs +++ b/turbopack/crates/turbopack-core/src/resolve/mod.rs @@ -698,17 +698,17 @@ impl ResolveResult { request, match item { ResolveResultItem::Source(source) => asset_fn(source).await?, - ResolveResultItem::External { - name, - ty, - // TODO remove this whole function? it's easy to drop traced - // externals now - traced: _, - } => ModuleResolveResultItem::External { - name, - ty, - traced: None, - }, + ResolveResultItem::External { name, ty, traced } => { + if traced == ExternalTraced::Traced { + // Should use map_primary_items instead + bail!("map_module doesn't handle traced externals"); + } + ModuleResolveResultItem::External { + name, + ty, + traced: None, + } + } ResolveResultItem::Ignore => ModuleResolveResultItem::Ignore, ResolveResultItem::Empty => ModuleResolveResultItem::Empty, ResolveResultItem::Error(e) => {