Skip to content

Commit 8a5939f

Browse files
authored
fix CommonJs modules no longer affecting the global scope (#43090)
1 parent 5813907 commit 8a5939f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/compiler/builderState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ namespace ts {
472472
*/
473473
function isFileAffectingGlobalScope(sourceFile: SourceFile) {
474474
return containsGlobalScopeAugmentation(sourceFile) ||
475-
!isExternalModule(sourceFile) && !containsOnlyAmbientModules(sourceFile);
475+
!isExternalOrCommonJsModule(sourceFile) && !containsOnlyAmbientModules(sourceFile);
476476
}
477477

478478
/**

tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-and-emits-them-correctly.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ module.exports = {};
151151
"../../src/common/nominal.js": {
152152
"version": "-9003723607-/**\n * @template T, Name\n * @typedef {T & {[Symbol.species]: Name}} Nominal\n */\nmodule.exports = {};\n",
153153
"signature": "-15964609857-export type Nominal<T, Name> = T & {\r\n [Symbol.species]: Name;\r\n};\r\n",
154-
"affectsGlobalScope": true
154+
"affectsGlobalScope": false
155155
}
156156
},
157157
"options": {

0 commit comments

Comments
 (0)