Skip to content

Commit 7f0126e

Browse files
committed
fix: make .env file optional in tsdown configuration to prevent build errors when missing
1 parent f6e3226 commit 7f0126e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

apps/cli/tsdown.config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { defineConfig } from "tsdown";
22
import { resolve, dirname } from "path";
3-
import { readFileSync } from "node:fs";
3+
import { readFileSync, existsSync } from "node:fs";
4+
5+
const envFile = resolve(import.meta.dirname, "../../.env");
46

57
export default defineConfig({
68
entry: ["src/index.ts"],
7-
envFile: "../../.env",
9+
envFile: existsSync(envFile) ? envFile : undefined,
810
envPrefix: ["SUPABASE_", "POSTHOG_", "NODE_ENV"],
911
format: ["esm"],
1012
dts: true,

0 commit comments

Comments
 (0)