Skip to content

Commit

Permalink
fix(@angular/build): only import persistent cache store with active c…
Browse files Browse the repository at this point in the history
…aching

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)
  • Loading branch information
clydin committed May 22, 2024
1 parent 2dbe21f commit 706423a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import assert from 'node:assert';
import * as path from 'node:path';
import { maxWorkers, useTypeChecking } from '../../../utils/environment-options';
import { JavaScriptTransformer } from '../javascript-transformer';
import { LmbdCacheStore } from '../lmdb-cache-store';
import { LoadResultCache, createCachedLoad } from '../load-result-cache';
import { logCumulativeDurations, profileAsync, resetCumulativeDurations } from '../profiling';
import { BundleStylesheetOptions } from '../stylesheets/bundle-options';
Expand Down Expand Up @@ -63,8 +62,9 @@ export function createCompilerPlugin(
const preserveSymlinks = build.initialOptions.preserveSymlinks;

// Initialize a worker pool for JavaScript transformations
let cacheStore: LmbdCacheStore | undefined;
let cacheStore: import('../lmdb-cache-store').LmbdCacheStore | undefined;
if (pluginOptions.sourceFileCache?.persistentCachePath) {
const { LmbdCacheStore } = await import('../lmdb-cache-store');
cacheStore = new LmbdCacheStore(
path.join(pluginOptions.sourceFileCache.persistentCachePath, 'angular-compiler.db'),
);
Expand Down

0 comments on commit 706423a

Please # to comment.