Skip to content

perf(@angular/cli): fix unnecessary esbuild rebuilds #30234

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
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
12 changes: 6 additions & 6 deletions packages/angular/build/src/tools/esbuild/bundler-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export class BundlerContext {
// When incremental always add any files from the load result cache
if (this.#loadCache) {
for (const file of this.#loadCache.watchFiles) {
if (!isInternalAngularFile(file)) {
if (!isInternalAngularFileOrEsBuildDefine(file)) {
// watch files are fully resolved paths
this.watchFiles.add(file);
}
Expand All @@ -260,7 +260,7 @@ export class BundlerContext {
if (this.incremental) {
// Add input files except virtual angular files which do not exist on disk
for (const input of Object.keys(result.metafile.inputs)) {
if (!isInternalAngularFile(input)) {
if (!isInternalAngularFileOrEsBuildDefine(input)) {
// input file paths are always relative to the workspace root
this.watchFiles.add(join(this.workspaceRoot, input));
}
Expand Down Expand Up @@ -417,12 +417,12 @@ export class BundlerContext {
#addErrorsToWatch(result: BuildFailure | BuildResult): void {
for (const error of result.errors) {
let file = error.location?.file;
if (file && !isInternalAngularFile(file)) {
if (file && !isInternalAngularFileOrEsBuildDefine(file)) {
this.watchFiles.add(join(this.workspaceRoot, file));
}
for (const note of error.notes) {
file = note.location?.file;
if (file && !isInternalAngularFile(file)) {
if (file && !isInternalAngularFileOrEsBuildDefine(file)) {
this.watchFiles.add(join(this.workspaceRoot, file));
}
}
Expand Down Expand Up @@ -475,6 +475,6 @@ export class BundlerContext {
}
}

function isInternalAngularFile(file: string) {
return file.startsWith('angular:');
function isInternalAngularFileOrEsBuildDefine(file: string) {
return file.startsWith('angular:') || file.startsWith('<define:');
}
Loading