Files
klz-cables.com/.pnpm-store/v10/files/b1/bec0544e97682e92dd0fd276df282a679dc33e3647b137d0a55749e0ebc00dd01954ef353220d9580d768bbeb38dadee1ce11e614764bb2e5b2da8f1e7f9be
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

28 lines
1.1 KiB
Plaintext

import nextEnvImport from '@next/env';
import { findUpSync } from '../utilities/findUp.js';
const { loadEnvConfig } = nextEnvImport;
/**
* Try to find user's env files and load it. Uses the same algorithm next.js uses to parse env files, meaning this also supports .env.local, .env.development, .env.production, etc.
*/ export function loadEnv(path) {
if (path?.length) {
loadEnvConfig(path, true);
return;
}
const dev = process.env.NODE_ENV !== 'production';
const { loadedEnvFiles } = loadEnvConfig(process.cwd(), dev);
if (!loadedEnvFiles?.length) {
// use findUp to find the env file. So, run loadEnvConfig for every directory upwards
findUpSync({
// @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
condition: (dir)=>{
const { loadedEnvFiles } = loadEnvConfig(dir, true);
if (loadedEnvFiles?.length) {
return true;
}
},
dir: process.cwd()
});
}
}
//# sourceMappingURL=loadEnv.js.map