Fix HMR import.meta.hot for Bun static analysis #1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "probablycorey/forge:fix/hmr-static-analysis"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bun's bundler treats
import.meta.hotas a compile-time feature, not a regular JS property. When you use optional chaining(
import.meta.hot?.dispose(...)), Bun can't statically determine whether to include or exclude the HMR code.By using a direct conditional instead, Bun can see at compile time that the block should be completely removed when HMR isn't enabled.
Oh nice! 🐾