Skip to content

Commit

Permalink
fix(@ngtools/webpack): disable ngcc async under Bazel
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alan-agius4 authored and mgechev committed Mar 13, 2020
1 parent dfd189f commit 47555e2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/ngtools/webpack/src/ngcc_processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,20 @@ export class NgccProcessor {

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

// Skip if node_modules are read-only
const corePackage = this.tryResolvePackage('@angular/core', this._nodeModulesDirectory);

// If the package.json is read only we should skip calling NGCC.
// With Bazel when running under sandbox the filesystem is read-only.
if (corePackage && isReadOnlyFile(corePackage)) {
timeEnd(timeLabel);

return;
}

const timeLabel = 'NgccProcessor.process';
time(timeLabel);

// We spawn instead of using the API because:
// - NGCC Async uses clustering which is problematic when used via the API which means
// that we cannot setup multiple cluster masters with different options.
Expand Down

0 comments on commit 47555e2

Please sign in to comment.