Skip to content

fix(@angular/cli): normalize Windows drive-letter casing for process.cwd - #33753

Open
clydin wants to merge 1 commit into
angular:mainfrom
clydin:fix/win32-cwd-drive-letter-casing
Open

fix(@angular/cli): normalize Windows drive-letter casing for process.cwd#33753
clydin wants to merge 1 commit into
angular:mainfrom
clydin:fix/win32-cwd-drive-letter-casing

Conversation

@clydin

@clydin clydin commented Aug 4, 2026

Copy link
Copy Markdown
Member

Windows cmd.exe and VS Code terminals often preserve lowercase drive letters (e.g. c:\...), which causes ESM module duplication in Node.js (e.g. loading vitest twice) and path lookup mismatches in tools like Vite and esbuild.

Normalizing process.cwd() early in CLI startup ensures consistent uppercase drive letter casing across all builders, worker threads, and ESM module resolution on Windows.

@clydin clydin added the target: patch This PR is targeted for the next patch release label Aug 4, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a normalization step for Windows environments in packages/angular/cli/lib/init.ts to ensure the drive letter in the current working directory is uppercase, preventing ESM module duplication and path lookup mismatches. The review feedback recommends wrapping the process.chdir call in a try...catch block to prevent potential CLI crashes if the directory change fails, and optimizing the logic by caching the result of process.cwd() to avoid redundant system calls.

Comment thread packages/angular/cli/lib/init.ts Outdated
Windows cmd.exe and VS Code terminals often preserve lowercase drive letters (e.g. c:\...), which causes ESM module duplication in Node.js (e.g. loading 'vitest' twice) and path lookup mismatches in tools like Vite and esbuild.

Normalizing process.cwd() early in CLI startup ensures consistent uppercase drive letter casing across all builders, worker threads, and ESM module resolution on Windows.
@clydin
clydin force-pushed the fix/win32-cwd-drive-letter-casing branch from ba41052 to 31b5f77 Compare August 4, 2026 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: @angular/cli target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant