@@ -533,12 +533,15 @@ export default class Module {
533533const foundNamespaceReexport =
534534name in this . namespaceReexportsByName
535535? this . namespaceReexportsByName [ name ]
536- : ( this . namespaceReexportsByName [ name ] = this . getVariableFromNamespaceReexports (
536+ : this . getVariableFromNamespaceReexports (
537537name ,
538538importerForSideEffects ,
539539searchedNamesAndModules ,
540540skipExternalNamespaceReexports
541- ) ) ;
541+ ) ;
542+ if ( ! skipExternalNamespaceReexports ) {
543+ this . namespaceReexportsByName [ name ] = foundNamespaceReexport ;
544+ }
542545if ( foundNamespaceReexport ) {
543546return foundNamespaceReexport ;
544547}
@@ -1012,8 +1015,18 @@ export default class Module {
10121015skipExternalNamespaceReexports = false
10131016) : Variable | null {
10141017let foundSyntheticDeclaration : SyntheticNamedExportVariable | null = null ;
1015- const skipExternalNamespaceValues = new Set ( [ true , skipExternalNamespaceReexports ] ) ;
1016- for ( const skipExternalNamespaces of skipExternalNamespaceValues ) {
1018+ const skipExternalNamespaceValues = [ { searchedNamesAndModules, skipExternalNamespaces : true } ] ;
1019+ if ( ! skipExternalNamespaceReexports ) {
1020+ const clonedSearchedNamesAndModules = new Map < string , Set < Module | ExternalModule > > ( ) ;
1021+ for ( const [ name , modules ] of searchedNamesAndModules || [ ] ) {
1022+ clonedSearchedNamesAndModules . set ( name , new Set ( modules ) ) ;
1023+ }
1024+ skipExternalNamespaceValues . push ( {
1025+ searchedNamesAndModules : clonedSearchedNamesAndModules ,
1026+ skipExternalNamespaces : false
1027+ } ) ;
1028+ }
1029+ for ( const { skipExternalNamespaces, searchedNamesAndModules } of skipExternalNamespaceValues ) {
10171030const foundDeclarations = new Set < Variable > ( ) ;
10181031for ( const module of this . exportAllModules ) {
10191032if ( module instanceof Module || ! skipExternalNamespaces ) {
0 commit comments