From 6948ef125ceec340d60cafc4a2b45c56cf2fefe3 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Tue, 29 May 2018 15:33:12 -0700 Subject: [PATCH] build(bazel): fix bazel built es5 ngfactory with secondary entry-point angular imports (#24170) PR Close #24170 --- packages/bazel/src/ng_package/packager.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/bazel/src/ng_package/packager.ts b/packages/bazel/src/ng_package/packager.ts index 603d8c5ef9..65733c52fe 100644 --- a/packages/bazel/src/ng_package/packager.ts +++ b/packages/bazel/src/ng_package/packager.ts @@ -211,7 +211,8 @@ function main(args: string[]): number { const entryPointName = entryPointPackageName.substr(rootPackageName.length + 1); if (!entryPointName) return; - createMetadataReexportFile(entryPointName, modulesManifest[entryPointPackageName]['metadata']); + createMetadataReexportFile( + entryPointName, modulesManifest[entryPointPackageName]['metadata'], entryPointPackageName); createTypingsReexportFile( entryPointName, licenseBanner, modulesManifest[entryPointPackageName]['typings']); @@ -318,7 +319,8 @@ function main(args: string[]): number { } /** Creates metadata re-export file for a secondary entry-point. */ - function createMetadataReexportFile(entryPointName: string, metadataFile: string) { + function createMetadataReexportFile( + entryPointName: string, metadataFile: string, packageName: string) { const inputPath = path.join(srcDir, `${entryPointName}.metadata.json`); writeFileFromInputPath(inputPath, JSON.stringify({ '__symbolic': 'module', @@ -327,6 +329,7 @@ function main(args: string[]): number { 'exports': [{'from': `${srcDirRelative(inputPath, metadataFile.replace(/.metadata.json$/, ''))}`}], 'flatModuleIndexRedirect': true, + 'importAs': packageName }) + '\n'); }