From 86a07237e60734686c80e2e231e6238619a04106 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Fri, 31 May 2024 10:54:28 -0400 Subject: [PATCH] fix(@angular/build): disable JS transformer persistent cache on web containers The backing store for the persistent caching of the JavaScript transformers is not currently supported on web containers. To allow other potential forms of caching, the JavaScript transformer caching is now selectively disabled when executed on a web container. This allows for development server prebundling to be used on web containers if needed. --- .../build/src/tools/esbuild/angular/compiler-plugin.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts b/packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts index 17cb0dbe40c9..9aa391e8331d 100644 --- a/packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts +++ b/packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts @@ -61,9 +61,10 @@ export function createCompilerPlugin( let setupWarnings: PartialMessage[] | undefined = []; const preserveSymlinks = build.initialOptions.preserveSymlinks; - // Initialize a worker pool for JavaScript transformations + // Initialize a worker pool for JavaScript transformations. + // Webcontainers currently do not support this persistent cache store. let cacheStore: import('../lmdb-cache-store').LmbdCacheStore | undefined; - if (pluginOptions.sourceFileCache?.persistentCachePath) { + if (pluginOptions.sourceFileCache?.persistentCachePath && !process.versions.webcontainer) { const { LmbdCacheStore } = await import('../lmdb-cache-store'); cacheStore = new LmbdCacheStore( path.join(pluginOptions.sourceFileCache.persistentCachePath, 'angular-compiler.db'),