Files
DECNET/decnet_web/src/lib/devGate.ts
anti 846a50dbbf feat(decnet_web/theme-lab): scaffold dev-gated /theme-lab route
Adds VITE_DECNET_DEVELOPER build-time gate: when unset, the
isDeveloperMode() helper collapses to a constant false and Vite
tree-shakes both the lazy import and the conditional <Route> out
of the prod bundle.

ThemeLab is currently a header stub; subsequent tasks fill it
with the design-system primitive zoo plus a Dark/Light toggle
for live token tuning. Route is intentionally absent from
ROUTE_LABELS / sidebar — direct URL only.
2026-05-09 03:18:34 -04:00

13 lines
430 B
TypeScript

/* Dev-only feature gate.
*
* Reads VITE_DECNET_DEVELOPER at build time. Vite inlines the value
* at compile, so a prod build with the flag unset becomes a constant
* `false` and the route guard plus its lazy import are tree-shaken
* out of the bundle entirely.
*
* Set in .env.development: VITE_DECNET_DEVELOPER=1
*/
export function isDeveloperMode(): boolean {
return import.meta.env.VITE_DECNET_DEVELOPER === '1';
}