diff --git a/package.json b/package.json index 3436491ab..932e9994c 100644 --- a/package.json +++ b/package.json @@ -152,6 +152,7 @@ "apexcharts": "^5.3.5", "clsx": "^2.1.1", "date-fns": "^4.1.0", + "esm-env": "^1.2.2", "flowbite": "^3.1.2", "tailwind-merge": "^3.3.1", "tailwind-variants": "^3.1.1" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 20fe0ab3f..73bb074fe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,9 @@ importers: date-fns: specifier: ^4.1.0 version: 4.1.0 + esm-env: + specifier: ^1.2.2 + version: 1.2.2 flowbite: specifier: ^3.1.2 version: 3.1.2(rollup@4.52.2) diff --git a/src/lib/theme/themeUtils.ts b/src/lib/theme/themeUtils.ts index eb180f862..4d1fba32a 100644 --- a/src/lib/theme/themeUtils.ts +++ b/src/lib/theme/themeUtils.ts @@ -1,9 +1,7 @@ import { type ThemeConfig } from "$lib"; import type { ClassValue } from "clsx"; import { getContext } from "svelte"; -// import { dev } from "$app/environment"; -// for svelte users not using sveltekit substitute the above line with the following line -const dev = import.meta.env.MODE === "development"; +import { DEV } from "esm-env"; export function getTheme(componentKey: K) { const theme = getContext("theme"); @@ -25,7 +23,7 @@ export type Classes }> = { * @param replacements - Optional map of deprecated keys to their replacements (e.g., "divClass" → "div"). */ export function warnThemeDeprecation(component: string, names: Record, replacements?: Record): void { - if (!dev) return; + if (!DEV) return; const nonEmptyNames = Object.keys(names).filter((name) => names[name]); if (nonEmptyNames.length === 0) return;