From 1be826db9f61ad905383c7111d3de31f1782a0da Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Fri, 6 Dec 2019 10:09:25 +0100 Subject: [PATCH 1/2] fix(@angular-devkit/build-angular): add symlinks option to resolveLoader This is needed as otherwise under Bazel it will fail with `Angular Compiler was detected but it was an instance of the wrong class.` when not using the linker since node_modules will be linked to `external/npm`. Under Bazel `preserveSymlinks` is to be set to true, however with the current behaviour this doesn't effect resolveLoader. --- .../src/angular-cli-files/models/webpack-configs/common.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts b/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts index 362c57807c9a..b6fb803b5087 100644 --- a/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts +++ b/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts @@ -489,6 +489,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration { alias, }, resolveLoader: { + symlinks: !buildOptions.preserveSymlinks, modules: loaderNodeModules, }, context: projectRoot, From 102111f9fffe4146cb9334e0865e45dae0a3c5aa Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Fri, 6 Dec 2019 17:21:24 +0100 Subject: [PATCH 2/2] fix(@angular-devkit/build-angular): resolve `@babel/preset-env` This is needed as otherwise under Bazel we hit `Cannot find module '@babel/preset-env` we use `require.resolve` since this is always patched under Bazel. --- .../build_angular/src/utils/process-bundle.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/angular_devkit/build_angular/src/utils/process-bundle.ts b/packages/angular_devkit/build_angular/src/utils/process-bundle.ts index 595076c6ea6f..fb35bba6e899 100644 --- a/packages/angular_devkit/build_angular/src/utils/process-bundle.ts +++ b/packages/angular_devkit/build_angular/src/utils/process-bundle.ts @@ -126,9 +126,15 @@ export async function process(options: ProcessBundleOptions): Promise