Skip to content

Commit d382413

Browse files
committed
fixup! fix(@angular/build): scope BundlerContext invalidation and cache one-shot bundle results
1 parent 10e9f39 commit d382413

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎packages/angular/build/src/tools/esbuild/bundler-context.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ export class BundlerContext {
223223

224224
// eslint-disable-next-line max-lines-per-function
225225
async #performBundle(): Promise<BundleContextResult> {
226+
this.#loadCacheKeys?.clear();
227+
226228
// Create esbuild options if not present
227229
if (this.#esbuildOptions === undefined) {
228230
if (this.incremental && !this.#loadCache) {

‎packages/angular/build/src/tools/esbuild/bundler-context_spec.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import assert from 'node:assert';
10-
import { mkdtemp, writeFile } from 'node:fs/promises';
10+
import { mkdtemp, readFile, writeFile } from 'node:fs/promises';
1111
import { join } from 'node:path';
1212
import { BundlerContext } from './bundler-context';
1313
import { MemoryLoadResultCache, createCachedLoad } from './load-result-cache';
@@ -125,9 +125,7 @@ describe('BundlerContext', () => {
125125
build.onLoad(
126126
{ filter: /\.css$/ },
127127
createCachedLoad(loadCache, async (args) => ({
128-
contents: await import('node:fs/promises').then((f) =>
129-
f.readFile(args.path, 'utf8'),
130-
),
128+
contents: await readFile(args.path, 'utf8'),
131129
loader: 'css',
132130
watchFiles: [args.path],
133131
})),

0 commit comments

Comments
 (0)