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

build(bazel): generalize fix for AMD name for flat module out file #26837

Closed
Closed
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
18 changes: 11 additions & 7 deletions packages/bazel/src/ngc-wrapped/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,20 @@ export function compile({allowNonHermeticReads, allDepsCompiledWithBazel = true,
// compilationTargetSrc.
// However we still want to give it an AMD module name for devmode.
// We can't easily tell which file is the synthetic one, so we build up the path we expect
// it to have
// and compare against that.
// it to have and compare against that.
if (fileName ===
path.join(compilerOpts.baseUrl, bazelOpts.package, compilerOpts.flatModuleOutFile + '.ts'))
return true;
// Also handle the case when angular is built from source as an external repository
if (fileName ===
path.join(
compilerOpts.baseUrl, 'external/angular', bazelOpts.package,
compilerOpts.flatModuleOutFile + '.ts'))
// Also handle the case the target is in an external repository.
// Pull the workspace name from the target which is formatted as `@wksp//package:target`
// if it the target is from an external workspace. If the target is from the local
// workspace then it will be formatted as `//package:target`.
const targetWorkspace = bazelOpts.target.split('/')[0].replace(/^@/, '');
gregmagolan marked this conversation as resolved.
Show resolved Hide resolved
if (targetWorkspace &&
fileName ===
path.join(
compilerOpts.baseUrl, 'external', targetWorkspace, bazelOpts.package,
compilerOpts.flatModuleOutFile + '.ts'))
return true;
return origBazelHostShouldNameModule(fileName) || NGC_GEN_FILES.test(fileName);
};
Expand Down