Skip to content

Commit 0574076

Browse files
committed
refactor(@angular/cli): allow opt-in Node.js compile cache for Bazel
When using the Angular CLI within Bazel, the Node.js compile cache can be enabled by setting the `NODE_COMPILE_CACHE` environment variable to a filesystem path. This allows opt-in usage based on the Bazel execution environment. Compile cache documentation: https://nodejs.org/api/module.html#module-compile-cache
1 parent bf2f5a8 commit 0574076

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/angular/cli/bin/bootstrap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
*/
2020

2121
// Enable on-disk code caching if available (Node.js 22.8+)
22-
// Skip if running inside Bazel via a RUNFILES environment variable check. The cache does not work
23-
// well with Bazel's hermeticity requirements.
24-
if (!process.env['RUNFILES']) {
22+
// Skip if running inside Bazel via a RUNFILES environment variable check and no explicit cache
23+
// location defined. The default cache location does not work well with Bazel's hermeticity requirements.
24+
if (!process.env['RUNFILES'] || process.env['NODE_COMPILE_CACHE']) {
2525
try {
2626
const { enableCompileCache } = require('node:module');
2727

0 commit comments

Comments
 (0)