solidjs / solid-refresh

MIT License
86 stars 18 forks source link

Using @solidjs/router completely breaks HMR #25

Closed utrolig closed 1 year ago

utrolig commented 1 year ago

Describe the bug

HMR seems to completely break if using @solidjs/router

I don't know if I'm doing anything weird here, but I've created a very minimal reproduction example.

Your Example Website or App

https://github.com/utrolig/solid-router-hmr-bug

Steps to Reproduce the Bug or Issue

  1. Try to edit file in src/pages/spaces/SpacesOverview.tsx
  2. HMR doesn't work.
  3. Restart app
  4. Page is now correct

Expected behavior

I expected HMR to work and update my page when I edit the file.

Platform

utrolig commented 1 year ago

I've done some more debugging myself and it seems like its related to the pages folder?

If I move everything out of the pages and into a components folder and delete the pages folder I'm able to get it to work again.

This didn't help in my actual project.

utrolig commented 1 year ago

So, this wasn't related to the router at all, but rather how folder/filenames on windows filesystems work.

So the import comes from import { SpacesOverview } from "./Spaces/SpacesOverview"; but the folder name is actually spaces. On windows the import still works, but HMR breaks.

When I tried to run it on my WSL, I got an error message instantly, changed the import, and everything works.

deluksic commented 1 year ago

On macOS I hit a similar issue, unrelated to HMR and solved it by using tsc --forceConsistentCasingInFileNames. So I get warned by typescript at least.