fix(@angular/build): canonicalize drive letter casing for workspace root on Windows#33567
Open
clydin wants to merge 1 commit into
Open
fix(@angular/build): canonicalize drive letter casing for workspace root on Windows#33567clydin wants to merge 1 commit into
clydin wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors path normalization across Angular builders by introducing a central canonicalizePath utility function that handles Windows drive-letter casing and symbolic link resolution. This utility is integrated into both the application and unit-test builders to ensure consistent workspace root resolution. A review comment correctly identifies that on Windows, calling realpathSync after drive-letter normalization can overwrite the uppercase casing, and suggests applying the normalization to the final resolved path instead.
…oot on Windows On Windows, process.cwd() casing can inherit the casing from the shell where the command was executed (e.g. lowercase c:\projects\my-app). When running builds or unit tests, the builders pass this workspaceRoot to underlying tools. Since Node's ESM loader and other tools resolve real file paths using canonical on-disk casing (which has an uppercase drive letter, C:\projects\my-app), the casing mismatches cause duplicate module imports (such as loading the vitest package twice) or path lookup mismatches. This introduces a shared canonicalizePath helper in utils/path.ts which normalizes the drive-letter casing of the workspace root to uppercase on Windows, and resolves symbolic links unless preserveSymlinks is enabled. It refactors the application and unit-test builders to use this shared helper.
d60c883 to
a51a11b
Compare
2 tasks
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.
On Windows, process.cwd() casing can inherit the casing from the shell where the command was executed (e.g. lowercase c:\projects\my-app). When running builds or unit tests, the builders pass this workspaceRoot to underlying tools.
Since Node's ESM loader and other tools resolve real file paths using canonical on-disk casing (which has an uppercase drive letter, C:\projects\my-app), the casing mismatches cause duplicate module imports (such as loading the vitest package twice) or path lookup mismatches.
This introduces a shared canonicalizePath helper in utils/path.ts which normalizes the drive-letter casing of the workspace root to uppercase on Windows, and resolves symbolic links unless preserveSymlinks is enabled. It refactors the application and unit-test builders to use this shared helper.