diff --git a/src/compiler/core.ts b/src/compiler/core.ts index ba81ee7d103..8a2040a83df 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -861,6 +861,10 @@ namespace ts { return fileExtensionIs(path, extension) ? path.substring(0, path.length - extension.length) : undefined; } + export function isJsxOrTsxExtension(ext: string): boolean { + return ext === ".jsx" || ext === ".tsx"; + } + export interface ObjectAllocator { getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node; getSourceFileConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => SourceFile; diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 0c060807b1f..5440b1a782b 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -646,7 +646,7 @@ namespace ts { return forEach(extensions, tryLoad); function tryLoad(ext: string): string { - if (state.skipTsx && (ext === ".jsx" || ext === ".tsx")) { + if (state.skipTsx && isJsxOrTsxExtension(ext)) { return undefined; } const fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext;