Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: normalize path case for style matching on case-insensitive systems#15652

Open
slegarraga wants to merge 1 commit intowithastro:mainfrom
slegarraga:fix/style-path-case
Open

fix: normalize path case for style matching on case-insensitive systems#15652
slegarraga wants to merge 1 commit intowithastro:mainfrom
slegarraga:fix/style-path-case

Conversation

@slegarraga
Copy link

Description

Fixes #14013

On Windows, when the working directory path case differs from the actual filesystem path (e.g. d:\dev vs D:\dev), styles are missing because Astro treats them as different files. The route component paths are computed relative to the root, so if the root has wrong casing, the paths won't match what Vite's module graph uses.

Changes

  • packages/astro/src/core/config/config.ts: resolveRoot() now normalizes the resolved path using fs.realpathSync() to ensure the path casing matches the actual filesystem. Falls back to the original resolved path if realpathSync fails.

  • packages/astro/test/units/config/config-resolve.test.js: Added unit tests for resolveRoot() verifying it returns the real filesystem path.

Testing

The fix ensures that resolveRoot() returns the canonical filesystem path regardless of how the user typed the directory name. This is transparent on case-sensitive systems (Linux/macOS) and fixes the style mismatch on case-insensitive systems (Windows).

On Windows, when the working directory path case differs from the actual
filesystem path (e.g. `d:\dev` vs `D:\dev`), styles are missing because
Astro treats them as different files.

This normalizes the resolved root path using `fs.realpathSync` to ensure
consistent casing on case-insensitive file systems.

Fixes withastro#14013
@changeset-bot
Copy link

changeset-bot bot commented Feb 25, 2026

🦋 Changeset detected

Latest commit: a049a3a

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Feb 25, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 25, 2026

Merging this PR will improve performance by 10.11%

⚡ 1 improved benchmark
✅ 17 untouched benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation Build: hybrid site (static + server) 8.8 s 8 s +10.11%

Comparing slegarraga:fix/style-path-case (a049a3a) with main (4c1a801)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (802426b) during the generation of this report, so 4c1a801 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Style missing when path case differs

1 participant