import { isLocalNetwork } from "../engine_networking_utils.js"; import { getParam } from "../engine_utils.js"; const noDevLogs = getParam("nodevlogs"); let _manuallySetDevEnvironment: boolean | undefined; let _cachedDevEnvironment: boolean | undefined; /** True when the application runs on a local url */ export function isDevEnvironment(): boolean { if (noDevLogs) return false; if (_manuallySetDevEnvironment !== undefined) return _manuallySetDevEnvironment; if (_cachedDevEnvironment !== undefined) return _cachedDevEnvironment; let res = isLocalNetwork(); if (!res) { // is stackblitz? res = typeof window !== "undefined" && window.location.hostname.endsWith(".local-credentialless.webcontainer.io"); } _cachedDevEnvironment = res; return res; } /** Enforce the dev environment flag to be true or false */ export function setDevEnvironment(val: boolean): void { _manuallySetDevEnvironment = val; }