Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(typescript): handle .tsx inputs to angular #2613

Merged
merged 1 commit into from
Apr 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,13 @@ export function createProgramAndEmit(
if (!/\.ng(factory|summary)\.ts$/.test(sf.fileName)) {
return false;
}
return isCompilationTarget(bazelOpts, {
fileName: sf.fileName.slice(0, /*'.ngfactory|ngsummary.ts'.length*/ -13) + '.ts'
} as ts.SourceFile);
const base = sf.fileName.slice(0, /*'.ngfactory|ngsummary.ts'.length*/ -13);
// It's possible a file was named ngsummary.ts or ngfactory.ts but *not* synthetic
// So verify that base.ts or base.tsx was originally part of the compilation
const tsCandidate = {fileName: `${base}.ts`} as ts.SourceFile;
const tsxCandidate = {fileName: `${base}.tsx`} as ts.SourceFile;
return isCompilationTarget(bazelOpts, tsCandidate) ||
isCompilationTarget(bazelOpts, tsxCandidate);
}

// If the Angular plugin is in use, this list of files to emit should exclude
Expand Down