fix(astro): handle case-insensitive paths when matching style modules#16237
Open
slegarraga wants to merge 1 commit intowithastro:mainfrom
Open
fix(astro): handle case-insensitive paths when matching style modules#16237slegarraga wants to merge 1 commit intowithastro:mainfrom
slegarraga wants to merge 1 commit intowithastro:mainfrom
Conversation
🦋 Changeset detectedLatest commit: c544c5f 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 |
On case-insensitive filesystems (Windows, macOS), running dev from a path whose casing differs from the canonical filesystem path (e.g. d:\dev\astro-demo vs D:\dev\astro-demo) caused inline <style> blocks to be silently dropped. The HMR handler compared file paths using strict equality, which failed when the casing of ctx.file differed from the key stored in the compile metadata map. Normalize path casing for comparison on case-insensitive platforms only (win32 and darwin), leaving Linux behavior completely unchanged. Fixes withastro#14013
771c183 to
c544c5f
Compare
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 case-insensitive filesystems (Windows, macOS), running
npm run devfrom a path with different casing than the canonical filesystem path caused inline<style>blocks to be silently dropped.Root cause
The HMR handler in
vite-plugin-astro/hmr.tscompared file paths using strict equality. When the casing ofctx.file(provided by Vite's watcher using the actual filesystem casing) differed from the key stored in the compile metadata map, lookups failed and CSS was never returned.Changes
win32anddarwin.astropackage.Testing
Existing HMR tests continue to pass. The fix is scoped to case-insensitive platforms so Linux behavior is unaffected.
Fixes #14013