solidjs / solid-refresh

MIT License
85 stars 18 forks source link

Fix reload pragma for Vite #63

Closed lxsmnsyc closed 5 months ago

lxsmnsyc commented 6 months ago

Fixes #22 (the comment, not the thread, since the thread is long fixed).

At some point between Vite 3 and Vite 5, Vite changed their way of checking whether a module should receive the HMR context or not. Previously, they required having the import.meta.hot.accept() call to notify the import analysis that module is going to self-accept.

Currently, they only check for the import.meta.hot expression, but that broke the HMR for Vite such that it's merging import.meta.hot.accept calls, leading to conflicts like declining HMR updates.

The fix here is to remove the unnecessary import.meta.hot.accept call.