-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular-devkit/build-angular): file is missing from the TypeScri…
…pt compilation with JIT Before this update, removing the modified file entry from `typeScriptFileCache` when a file was saved but unmodified created an issue. The TypeScript compiler didn't re-emit the file using `emitNextAffectedFile` because the file hashes remained unchanged. Consequently, this led to missing files in the esbuild compilation process. In the current update, we no longer delete entries from typeScriptFileCache. This adjustment resolves the problem by ensuring the proper handling of file recompilation and prevents files from going missing during the esbuild compilation. Closes #26635 (cherry picked from commit 0f253a1)
- Loading branch information
1 parent
3623fe9
commit f2f7d7c
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...ild_angular/src/builders/application/tests/behavior/typescript-rebuild-touch-file_spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import { concatMap, count, take, timeout } from 'rxjs'; | ||
import { buildApplication } from '../../index'; | ||
import { APPLICATION_BUILDER_INFO, BASE_OPTIONS, describeBuilder } from '../setup'; | ||
|
||
describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => { | ||
describe('Behavior: "Rebuilds when touching file"', () => { | ||
for (const aot of [true, false]) { | ||
it(`Rebuild correctly when file is touched with ${aot ? 'AOT' : 'JIT'}`, async () => { | ||
harness.useTarget('build', { | ||
...BASE_OPTIONS, | ||
watch: true, | ||
aot, | ||
}); | ||
|
||
const buildCount = await harness | ||
.execute({ outputLogsOnFailure: false }) | ||
.pipe( | ||
timeout(30_000), | ||
concatMap(async ({ result }, index) => { | ||
switch (index) { | ||
case 0: | ||
expect(result?.success).toBeTrue(); | ||
// Touch a file without doing any changes. | ||
await harness.modifyFile('src/app/app.component.ts', (content) => content); | ||
break; | ||
case 1: | ||
expect(result?.success).toBeTrue(); | ||
await harness.removeFile('src/app/app.component.ts'); | ||
break; | ||
case 2: | ||
expect(result?.success).toBeFalse(); | ||
break; | ||
} | ||
}), | ||
take(3), | ||
count(), | ||
) | ||
.toPromise(); | ||
|
||
expect(buildCount).toBe(3); | ||
}); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters