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 <noreply@anthropic.com>
This commit is contained in:
Corey Johnson 2026-01-20 10:46:15 -08:00
parent e14821c699
commit 8484553029

View File

@ -10,7 +10,9 @@ export function clearStyles() {
} }
// HMR support - clear styles when module is replaced // 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<const T extends Record<string, string | number>>(name: string, values: T): T { export function createTheme<const T extends Record<string, string | number>>(name: string, values: T): T {
themes[name] = values as Record<string, string | number> themes[name] = values as Record<string, string | number>