Skip to content

Conversation

Duncank
Copy link

@Duncank Duncank commented Dec 9, 2024

On windows, the path in the checkReload functions is written like:

C:\Users\{foldername}\src\assets\icons\add.svg

while the iconsPath the picomatch function compares it to is written in posix-style:

[ 'C:/Users/{foldername}/src/assets/icons/*.svg' ]

This PR normalizes the first path, so the shouldReload check returns true when comparing both paths above, whereas it returned false before this, and never recreated the sprite.

@DavyJones21
Copy link

I really need this fix.

Have issue on vite 4.5.13 (may be the same on other versions, I haven't checked it). With this correction, an error appears in line: hot.send({ type: "full-reload", path: "*" }); with text: Sprite error TypeError: Cannot read properties of undefined (reading 'send'). Instead of hot it should be ws then the code will work correctly and look like this ws.send({ type: "full-reload", path: "*" }).

Сan you confirm?

@Duncank
Copy link
Author

Duncank commented Apr 28, 2025

I'm unable to reproduce that error, but the scope of it does not seem to be within my changed code either since I'm only performing an extra path check here.
I'm using vite 6.0.11 by the way.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants