fix: resolve vite.config.ts alias path on native Windows without WSL #110

Open
kluoxx wants to merge 1 commit from fix/vite-config-windows-path into main
Member

new URL("./src", import.meta.url).pathname produces a path with a leading slash before the drive letter on Windows (e.g. /C:/Users/...), which isn't a valid filesystem path outside WSL/Linux/macOS. This breaks the @ import alias and all @/... imports when running Vite directly via npx vite on native Windows, though it works fine under devenv (which runs through WSL) or on Mac/Linux. Switched to Node's fileURLToPath, which correctly handles Windows paths in all environments.

new URL("./src", import.meta.url).pathname produces a path with a leading slash before the drive letter on Windows (e.g. /C:/Users/...), which isn't a valid filesystem path outside WSL/Linux/macOS. This breaks the @ import alias and all @/... imports when running Vite directly via npx vite on native Windows, though it works fine under devenv (which runs through WSL) or on Mac/Linux. Switched to Node's fileURLToPath, which correctly handles Windows paths in all environments.
fix: resolve vite.config.ts alias path on native Windows without WSL
All checks were successful
kennel/build build succeeded
kennel/deploy deployment healthy
CI / check-openapi (pull_request) Successful in 6m0s
CI / check-1 (pull_request) Successful in 8m54s
CI / build (pull_request) Successful in 13m33s
CI / check (pull_request) Successful in 0s
PR size / size (pull_request) Successful in 4s
PR title / lint (pull_request) Successful in 0s
128840a908

Kennel Deployments

Service URL
backend https://housing-backend-pr-110.scottylabs.net

Last updated for commit 128840a.

<!-- kennel-deployment --> ### Kennel Deployments | Service | URL | | --- | --- | | backend | https://housing-backend-pr-110.scottylabs.net | Last updated for commit `128840a`.
All checks were successful
kennel/build build succeeded
kennel/deploy deployment healthy
CI / check-openapi (pull_request) Successful in 6m0s
CI / check-1 (pull_request) Successful in 8m54s
CI / build (pull_request) Successful in 13m33s
CI / check (pull_request) Successful in 0s
PR size / size (pull_request) Successful in 4s
PR title / lint (pull_request) Successful in 0s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/vite-config-windows-path:fix/vite-config-windows-path
git switch fix/vite-config-windows-path
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ScottyLabs/housing!110
No description provided.