Skip to content

fix(@angular-devkit/build-angular): file is missing from the TypeScript compilation with JIT #26640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
});
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export class SourceFileCache extends Map<string, ts.SourceFile> {
}
for (let file of files) {
file = path.normalize(file);
this.typeScriptFileCache.delete(file);
this.loadResultCache.invalidate(file);

// Normalize separators to allow matching TypeScript Host paths
Expand Down