Skip to content

Commit 706423a

Browse files
committed
fix(@angular/build): only import persistent cache store with active caching
To avoid loading and initializing the underlying persistent cache store when caching is disabled, the lmdb-based cache will now only be imported when caching is enabled. (cherry picked from commit 1fc10ec)
1 parent 2dbe21f commit 706423a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import assert from 'node:assert';
1919
import * as path from 'node:path';
2020
import { maxWorkers, useTypeChecking } from '../../../utils/environment-options';
2121
import { JavaScriptTransformer } from '../javascript-transformer';
22-
import { LmbdCacheStore } from '../lmdb-cache-store';
2322
import { LoadResultCache, createCachedLoad } from '../load-result-cache';
2423
import { logCumulativeDurations, profileAsync, resetCumulativeDurations } from '../profiling';
2524
import { BundleStylesheetOptions } from '../stylesheets/bundle-options';
@@ -63,8 +62,9 @@ export function createCompilerPlugin(
6362
const preserveSymlinks = build.initialOptions.preserveSymlinks;
6463

6564
// Initialize a worker pool for JavaScript transformations
66-
let cacheStore: LmbdCacheStore | undefined;
65+
let cacheStore: import('../lmdb-cache-store').LmbdCacheStore | undefined;
6766
if (pluginOptions.sourceFileCache?.persistentCachePath) {
67+
const { LmbdCacheStore } = await import('../lmdb-cache-store');
6868
cacheStore = new LmbdCacheStore(
6969
path.join(pluginOptions.sourceFileCache.persistentCachePath, 'angular-compiler.db'),
7070
);

0 commit comments

Comments
 (0)