intrnl/vite-plugin-svelte

HMR working?

Manborough opened this issue · 3 comments

I've downloaded your starter template and it doesn't seem like HMR is working. Is it supposed to be?
I've recorded an exciting gif that demonstrates the issue.

ezgif-2-9e761d3159e2

It should work, not sure what's happening there.

Unfortunately I'm away with only my phone and I'm not sure as to when I'd be back. Perhaps it would be days before I can get back to resolving this issue.

If you're fine with working without HMR, you could pass hot: false to disable it.

Righto, I'll try redownloading it, whenever i can next find the time, and see if it works.

Ah, it seems that this is due to svelte-hmr preserving local states that Svelte has marked as reactive (root scope var declarations).

You could either pass noPreserveState: true in HMR options or change the arrow function to regular ones. I'll do the latter for the template.