@@ -225,8 +225,6 @@ const compareNumbers = (a, b) => {
225225const bySourceOrder = createComparator ( "sourceOrder" , compareNumbers ) ;
226226const byRangeStart = createComparator ( "rangeStart" , compareNumbers ) ;
227227
228- const INITIAL_USED_NAMES = new Set ( RESERVED_NAMES ) ;
229-
230228/**
231229 * @param {Iterable<string> } iterable iterable object
232230 * @returns {string } joined iterable object
@@ -1277,18 +1275,8 @@ class ConcatenatedModule extends Module {
12771275 /** @type {NeededNamespaceObjects } */
12781276 const neededNamespaceObjects = new Set ( ) ;
12791277
1280- // Default disallowed names
1281- const allUsedNames = new Set ( INITIAL_USED_NAMES ) ;
1282- const chunks = chunkGraph . getModuleChunks ( this ) ;
1283-
1284- // Add names already used in the current chunk scope
1285- for ( const chunk of chunks ) {
1286- if ( ConcatenationScope . chunkUsedNames . has ( chunk ) ) {
1287- for ( const name of ConcatenationScope . chunkUsedNames . get ( chunk ) || [ ] ) {
1288- allUsedNames . add ( name ) ;
1289- }
1290- }
1291- }
1278+ // List of all used names to avoid conflicts
1279+ const allUsedNames = new Set ( RESERVED_NAMES ) ;
12921280
12931281 // Generate source code and analyse scopes
12941282 // Prepare a ReplaceSource for the final source
@@ -1307,23 +1295,6 @@ class ConcatenatedModule extends Module {
13071295 ) ;
13081296 }
13091297
1310- // Record the names registered by the current ConcatenatedModule into the chunk scope
1311- if ( INITIAL_USED_NAMES . size !== allUsedNames . size ) {
1312- for ( const name of allUsedNames ) {
1313- if ( INITIAL_USED_NAMES . has ( name ) ) continue ;
1314-
1315- for ( const chunk of chunks ) {
1316- if ( ! ConcatenationScope . chunkUsedNames . has ( chunk ) ) {
1317- ConcatenationScope . chunkUsedNames . set ( chunk , new Set ( [ name ] ) ) ;
1318- } else {
1319- /** @type {Set<string> } */ (
1320- ConcatenationScope . chunkUsedNames . get ( chunk )
1321- ) . add ( name ) ;
1322- }
1323- }
1324- }
1325- }
1326-
13271298 // Updated Top level declarations are created by renaming
13281299 /** @type {TopLevelDeclarations } */
13291300 const topLevelDeclarations = new Set ( ) ;
0 commit comments