Skip to content

Commit 47555e2

Browse files
alan-agius4mgechev
authored andcommitted
fix(@ngtools/webpack): disable ngcc async under Bazel
Under Bazel some dependencies might be readonly we shouldn't run NGCC async version because we are unable to verify which modules are read-only and which not.
1 parent dfd189f commit 47555e2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

packages/ngtools/webpack/src/ngcc_processor.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,20 @@ export class NgccProcessor {
5252

5353
/** Process the entire node modules tree. */
5454
process() {
55-
const timeLabel = 'NgccProcessor.process';
56-
time(timeLabel);
55+
// Under Bazel when running in sandbox mode parts of the filesystem is read-only.
56+
if (process.env.BAZEL_TARGET) {
57+
return;
58+
}
5759

60+
// Skip if node_modules are read-only
5861
const corePackage = this.tryResolvePackage('@angular/core', this._nodeModulesDirectory);
59-
60-
// If the package.json is read only we should skip calling NGCC.
61-
// With Bazel when running under sandbox the filesystem is read-only.
6262
if (corePackage && isReadOnlyFile(corePackage)) {
63-
timeEnd(timeLabel);
64-
6563
return;
6664
}
6765

66+
const timeLabel = 'NgccProcessor.process';
67+
time(timeLabel);
68+
6869
// We spawn instead of using the API because:
6970
// - NGCC Async uses clustering which is problematic when used via the API which means
7071
// that we cannot setup multiple cluster masters with different options.

0 commit comments

Comments
 (0)