nextjs magic

This commit is contained in:
Igor Loskutov
2025-09-05 12:44:12 -04:00
parent 2962ba5a7b
commit 83f3d0bc9d

View File

@@ -29,9 +29,8 @@ export function edgeDomainToKey(domain: string) {
// get edge config server-side (prefer DomainContext when available), domain is the hostname // get edge config server-side (prefer DomainContext when available), domain is the hostname
export async function getConfig() { export async function getConfig() {
if (process.env.NEXT_PUBLIC_ENV === "development") { if (process.env.NEXT_PUBLIC_ENV === "development") {
// helps to stop nextjs build from eager loading. don't inline it. // helps to stop nextjs build from eager loading. don't "require()" it
const configPath = "../../config"; return (await import("../../config")).localConfig;
return require(configPath).localConfig;
} }
const domain = new URL(process.env.NEXT_PUBLIC_SITE_URL!).hostname; const domain = new URL(process.env.NEXT_PUBLIC_SITE_URL!).hostname;