2026-05-25 05:15:34 -04:00
|
|
|
import initializeApp from "./initializeApp.js";
|
|
|
|
|
|
2026-05-26 02:15:59 -04:00
|
|
|
// Skip during Next.js build/prerender — bootstrap would download cloudflared, init DNS, etc.
|
|
|
|
|
const isBuildPhase = process.env.NEXT_PHASE === "phase-production-build"
|
|
|
|
|
|| process.env.NEXT_PHASE === "phase-export"
|
|
|
|
|
|| process.env.NEXT_PHASE === "phase-static";
|
|
|
|
|
|
2026-05-25 05:15:34 -04:00
|
|
|
// Server-only singleton: guard via global so HMR / re-imports don't double-init
|
2026-05-26 02:15:59 -04:00
|
|
|
if (typeof window === "undefined" && !isBuildPhase && !global.__appBootstrapped) {
|
2026-05-25 05:15:34 -04:00
|
|
|
global.__appBootstrapped = true;
|
|
|
|
|
initializeApp().catch((e) => console.error("[Bootstrap] init failed:", e.message));
|
|
|
|
|
}
|