From 8484553029786de0c0e3d6d9b5db7101d311b3fd Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 20 Jan 2026 10:46:15 -0800 Subject: [PATCH] Fix HMR import.meta.hot for Bun static analysis Use direct conditional instead of optional chaining so Bun can statically analyze and remove the HMR block in production builds. Co-Authored-By: Claude Opus 4.5 --- src/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index acb1b8f..d5751ce 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -10,7 +10,9 @@ export function clearStyles() { } // HMR support - clear styles when module is replaced -import.meta.hot?.dispose(() => clearStyles()) +if (import.meta.hot) { + import.meta.hot.dispose(() => clearStyles()) +} export function createTheme>(name: string, values: T): T { themes[name] = values as Record