Skip to content

Commit 3c9a3c5

Browse files
committed
Merge pull request #3029 from Microsoft/outputJsFiles
emit input non .ts files as separate files when 'allowNonTsExtensions' a...
2 parents 15f4b58 + 8279667 commit 3c9a3c5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/compiler/utilities.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,8 +1435,10 @@ module ts {
14351435

14361436
export function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean {
14371437
if (!isDeclarationFile(sourceFile)) {
1438-
if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.fileName, ".js")) {
1439-
return true;
1438+
if ((isExternalModule(sourceFile) || !compilerOptions.out)) {
1439+
// 1. in-browser single file compilation scenario
1440+
// 2. non .js file
1441+
return compilerOptions.separateCompilation || !fileExtensionIs(sourceFile.fileName, ".js");
14401442
}
14411443
return false;
14421444
}

0 commit comments

Comments
 (0)