Skip to content

Commit 59803b1

Browse files
committed
fix(@angular/build): use rootDir for HMR component updates path resolution
Use `compilerOptions.rootDir` when calculating the relative path for HMR component updates, falling back to the current directory if not set. This ensures correct path resolution when `rootDir` is configured in `tsconfig`. Closes #33005 and closes #32998
1 parent cf5b49e commit 59803b1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/angular/build/src/tools/angular/compilation/aot-compilation.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ export class AotCompilation extends AngularCompilation {
152152
continue;
153153
}
154154
const componentFilename = node.getSourceFile().fileName;
155-
let relativePath = relative(host.getCurrentDirectory(), componentFilename);
155+
let relativePath = relative(
156+
compilerOptions.rootDir ?? host.getCurrentDirectory(),
157+
componentFilename,
158+
);
156159
if (relativePath.startsWith('..')) {
157160
relativePath = componentFilename;
158161
}

0 commit comments

Comments
 (0)