Skip to content

Commit

Permalink
__turbopack_export_namespace__(__turbopack_import__({}))
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Oct 16, 2024
1 parent 41a1acb commit a9a4f2e
Showing 1 changed file with 1 addition and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,39 +159,12 @@ impl EcmascriptChunkItem for SideEffectsModuleChunkItem {

code.push_bytes(
format!(
"const mod = __turbopack_import__({});\n",
"__turbopack_export_namespace__(__turbopack_import__({}));\n",
StringifyJs(&*module.module.ident().to_string().await?)
)
.as_bytes(),
);

match module.new_name {
Some(new_name) => {
code.push_bytes(
format!(
"__turbopack_esm__({{
{name}: () => mod[{new_name}],
}});\n",
name = StringifyJs(&*module.export_name.await?),
new_name = StringifyJs(&*new_name.await?),
)
.as_bytes(),
);
}

None => {
code.push_bytes(
format!(
"__turbopack_esm__({{
{name}: () => mod
}});\n",
name = StringifyJs(&*module.export_name.await?),
)
.as_bytes(),
);
}
}

for &side_effect in self.module.await?.side_effects.await?.iter() {
if !has_top_level_await {
let async_module = *side_effect.get_async_module().await?;
Expand Down

0 comments on commit a9a4f2e

Please sign in to comment.