// Кросс-бандлерное чтение env без "process is not defined"
export function getEnv(key: string): string | undefined {
  // Vite
  if (typeof import.meta !== "undefined" && (import.meta as any).env) {
    const v = (import.meta as any).env[key];
    if (typeof v === "string" && v.length) return v;
  }
  // CRA / Webpack
  if (typeof process !== "undefined" && (process as any).env) {
    const v = (process as any).env[key];
    if (typeof v === "string" && v.length) return v;
  }
  return undefined;
}
