Open zephraph opened 2 years ago
is this something that can safely be published that way? or will it inhibit some bundlers or environments?
I've got a safer solution. It's a minor breaking change, but worth it I think. I'll PR it.
I've got a safer solution. It's a minor breaking change, but worth it I think. I'll PR it.
@zephraph Could you say more about this change? I'm going to re-implement the same pattern very soon and I'd love to have HMR
HMR api has been improved in vite3 https://vitejs.dev/blog/announcing-vite3.html#dev-improvements
I'm using vite and in dev mode when HMR happens on a module that calls a tunnel, the tunnel itself isn't re-rendered.
I've written a helper as a work-around:
The helper requires a key so that it can persist the tunnel instance in
import.meta.hot.data
. I'm not incredibly experienced in HMR, so I'm not sure if there's a better solution here.I believe the issue may have been masked before because we were never clearing the tunnel contents.