Skip to content

Commit

Permalink
Properly use star reexports
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Sep 25, 2024
1 parent 2e3bbe0 commit 8f85eeb
Showing 1 changed file with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,16 @@ impl Module for EcmascriptModuleFacadeModule {
references
}
ModulePart::StarReexports { .. } => {
vec![]
let Some(module) =
Vc::try_resolve_sidecast::<Box<dyn EcmascriptAnalyzable>>(self.module).await?
else {
bail!(
"Expected EcmascriptModuleAsset for a EcmascriptModuleFacadeModule with \
ModulePart::Evaluation"
);
};
let result = module.analyze().await?;
result.reexport_references.await?.clone_value()
}
ModulePart::Facade => {
vec![
Expand Down Expand Up @@ -201,7 +210,16 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleFacadeModule {
}
star_exports.extend(esm_exports.star_exports.iter().copied());
}
ModulePart::StarReexports => {}
ModulePart::StarReexports => {
let EcmascriptExports::EsmExports(esm_exports) = *self.module.get_exports().await?
else {
bail!(
"EcmascriptModuleFacadeModule must only be used on modules with EsmExports"
);
};
let esm_exports = esm_exports.await?;
star_exports.extend(esm_exports.star_exports.iter().copied());
}
ModulePart::Facade => {
// Reexport everything from the reexports module
// (including default export if any)
Expand Down

0 comments on commit 8f85eeb

Please sign in to comment.