solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

[Bug?]: HMR not working with filesystem routes

Open Brendonovich opened this issue 1 year ago • 4 comments

Duplicates

  • [X] I have searched the existing issues

Latest version

  • [X] I have tested the latest version

Current behavior 😯

Editing a file in routes/ that has a default export will cause a full reload, rather than use HMR.

Expected behavior 🤔

HMR should work like in all other files

Steps to reproduce 🕹

Steps:

  1. Go to https://stackblitz.com/edit/github-htmjmk-karq32?file=src%2Froutes%2Findex.tsx
  2. Try editing each component.
  3. Notice that HMR doesn't work in routes/index.tsx, but works in IHaveHMR.tsx and routes/MeToo.tsx

Context 🔦

i like hmr, nuff said

Your environment 🌎

No response

Brendonovich avatar Mar 14 '24 13:03 Brendonovich

This is expected, see: https://github.com/solidjs/solid-refresh?tab=readme-ov-file#how-it-works

We used to have this feature before but it was problematic, so always give components a name.

Relevant Discord discussion: https://discord.com/channels/722131463138705510/722131463889223772/1216948069602689155

lxsmnsyc avatar Mar 14 '24 15:03 lxsmnsyc

@lxsmnsyc only allowing named components makes sense, but is that the reason why ButNotMe doesn't have HMR even though it's named? image

Brendonovich avatar Mar 14 '24 15:03 Brendonovich

@Brendonovich the transform is correct for this one, however I'm confident that something else might be contributing to this behavior, maybe Vinxi.

lxsmnsyc avatar Mar 15 '24 11:03 lxsmnsyc