-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Documentation: https://bun.com/docs/bundler/hot-reloading
Bun implements a client-side HMR API modeled after Vite's import.meta.hot API
So most of the code implemented for Vite can be reused for Bun's implementation.
However, this check is often not needed as Bun will dead-code-eliminate calls to all of the HMR APIs in production builds.
For this to work, Bun forces these APIs to be called without indirection. That means the following do not work:
The only thing to consider is that "const hot = import.meta.hot;" cannot work in Bun (which results in "error: import.meta.hot.data cannot be used indirectly."), i.g. _$$refresh("vite", import.meta.hot, _REGISTRY);. All destructured hot calls need to be replaced with import.meta.hot.
Metadata
Metadata
Assignees
Labels
No labels