refactor(@angular/build): remove unnecessary realpath resolution for workspace root - #33661
Merged
alan-agius4 merged 1 commit intoJul 28, 2026
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request simplifies path canonicalization by removing symbolic link resolution from canonicalizePath and deleting the remapMetafileBasePath utility along with its associated tests. Feedback on these changes includes removing the orphaned JSDoc block for the deleted remapMetafileBasePath function, cleaning up unused imports (toPosixPath and resolve) in bundler-context.ts, and expanding the test suite for canonicalizePath to cover Windows-specific drive-letter casing normalization.
…workspace root Previously, `canonicalizePath` resolved `context.workspaceRoot` using `realpathSync` unless `preserveSymlinks` was enabled. Resolving the workspace root was originally intended to align workspace paths with Node/TypeScript default physical file resolution, but created an unnecessary path asymmetry between `preserveSymlinks` settings and mutated the logical workspace path. Furthermore, passing the resolved real path as `absWorkingDir` to esbuild caused esbuild to format metafile paths relative to the real path rather than the logical workspace root. This required workarounds to remap metafile paths back to the workspace root. This change is safe today because Angular compiler plugins and path resolution utilities normalize relative paths dynamically without requiring `workspaceRoot` to be realpath'd. Removing `realpathSync` from `canonicalizePath` ensures `workspaceRoot` consistently remains the logical workspace path across all builders, esbuild natively formats metafile paths relative to `workspaceRoot`, and `remapMetafileBasePath` is no longer needed.
clydin
force-pushed
the
refactor-workspace-root-realpath
branch
from
July 27, 2026 16:08
ddd9bfc to
bea7b63
Compare
alan-agius4
approved these changes
Jul 28, 2026
Collaborator
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously,
canonicalizePathresolvedcontext.workspaceRootusingrealpathSyncunlesspreserveSymlinkswas enabled. Resolving the workspace root was originally intended to align workspace paths with Node/TypeScript default physical file resolution, but created an unnecessary path asymmetry betweenpreserveSymlinkssettings and mutated the logical workspace path.Furthermore, passing the resolved real path as
absWorkingDirto esbuild caused esbuild to format metafile paths relative to the real path rather than the logical workspace root. This required workarounds to remap metafile paths back to the workspace root.This change is safe today because Angular compiler plugins and path resolution utilities normalize relative paths dynamically without requiring
workspaceRootto be realpath'd. RemovingrealpathSyncfromcanonicalizePathensuresworkspaceRootconsistently remains the logical workspace path across all builders, esbuild natively formats metafile paths relative toworkspaceRoot, andremapMetafileBasePathis no longer needed.