Skip to content

Commit de17cbc

Browse files
committed
Revert "perf(@angular/cli): enable Node.js compile code cache when available"
This reverts commit ecc107d.
1 parent ac71ce1 commit de17cbc

File tree

5 files changed

+2
-34
lines changed

5 files changed

+2
-34
lines changed

packages/angular/build/src/tools/angular/compilation/parallel-compilation.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import type { CompilerOptions } from '@angular/compiler-cli';
1010
import type { PartialMessage } from 'esbuild';
11-
import { createRequire, getCompileCacheDir } from 'node:module';
11+
import { createRequire } from 'node:module';
1212
import { MessageChannel } from 'node:worker_threads';
1313
import Piscina from 'piscina';
1414
import type { SourceFile } from 'typescript';
@@ -41,11 +41,6 @@ export class ParallelCompilation extends AngularCompilation {
4141
useAtomics: !process.versions.webcontainer,
4242
filename: localRequire.resolve('./parallel-worker'),
4343
recordTiming: false,
44-
env: {
45-
...process.env,
46-
// Enable compile code caching if enabled for the main process (only exists on Node.js v22.8+)
47-
'NODE_COMPILE_CACHE': getCompileCacheDir?.(),
48-
},
4944
});
5045
}
5146

packages/angular/build/src/tools/esbuild/javascript-transformer.ts

-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import { createHash } from 'node:crypto';
1010
import { readFile } from 'node:fs/promises';
11-
import { getCompileCacheDir } from 'node:module';
1211
import Piscina from 'piscina';
1312
import { Cache } from './cache';
1413

@@ -63,11 +62,6 @@ export class JavaScriptTransformer {
6362
// Shutdown idle threads after 1 second of inactivity
6463
idleTimeout: 1000,
6564
recordTiming: false,
66-
env: {
67-
...process.env,
68-
// Enable compile code caching if enabled for the main process (only exists on Node.js v22.8+)
69-
'NODE_COMPILE_CACHE': getCompileCacheDir?.(),
70-
},
7165
});
7266

7367
return this.#workerPool;

packages/angular/build/src/tools/sass/sass-service.ts

-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
import assert from 'node:assert';
10-
import { getCompileCacheDir } from 'node:module';
1110
import { fileURLToPath, pathToFileURL } from 'node:url';
1211
import { MessageChannel } from 'node:worker_threads';
1312
import { Piscina } from 'piscina';
@@ -103,11 +102,6 @@ export class SassWorkerImplementation {
103102
// Shutdown idle threads after 1 second of inactivity
104103
idleTimeout: 1000,
105104
recordTiming: false,
106-
env: {
107-
...process.env,
108-
// Enable compile code caching if enabled for the main process (only exists on Node.js v22.8+)
109-
'NODE_COMPILE_CACHE': getCompileCacheDir?.(),
110-
},
111105
});
112106

113107
return this.#workerPool;

packages/angular/build/src/typings.d.ts

-7
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,3 @@
1717
declare module 'esbuild' {
1818
export * from 'esbuild-wasm';
1919
}
20-
21-
/**
22-
* Augment the Node.js module builtin types to support the v22.8+ compile cache functions
23-
*/
24-
declare module 'node:module' {
25-
function getCompileCacheDir(): string | undefined;
26-
}

packages/angular/cli/bin/bootstrap.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,4 @@
1818
* range.
1919
*/
2020

21-
// Enable on-disk code caching if available (Node.js 22.8+)
22-
try {
23-
const { enableCompileCache } = require('node:module');
24-
25-
enableCompileCache?.();
26-
} catch {}
27-
28-
// Initialize the Angular CLI
29-
void import('../lib/init.js');
21+
import('../lib/init.js');

0 commit comments

Comments
 (0)