// Shared Vite `define` block that injects the build-time __APP_ENV__ constant
// consumed by src/config/env.ts. Sourced from process.env.APP_ENV (default 'dev').

const raw = process.env.APP_ENV ?? "dev";
if (raw !== "dev" && raw !== "prod") {
  throw new Error(`APP_ENV must be "dev" or "prod", got: ${raw}`);
}

export const appEnv = raw;

export const defineEnv = {
  __APP_ENV__: JSON.stringify(appEnv),
};
