/** * Environment loader — must be the FIRST import in index.js. * * ES module imports are hoisted, so dotenv.config() must run * inside a module that is imported before any module that reads * process.env at the top level. */ import dotenv from "dotenv"; import { fileURLToPath } from "url"; import { dirname, join } from "path"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); dotenv.config({ path: join(__dirname, "../../.env") });