Skip to content

Commit a3e7551

Browse files
authored
wrangler should not try to handle .env files (#800)
1 parent d18cd9d commit a3e7551

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.changeset/tasty-teeth-do.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
wrangler should not load .env files

packages/cloudflare/src/cli/utils/run-wrangler.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ export function runWrangler(options: BuildOptions, args: string[], wranglerOpts:
7676
env: {
7777
...process.env,
7878
...(wranglerOpts.logging === "error" ? { WRANGLER_LOG: "error" } : undefined),
79+
// `.env` files are handled by the adapter.
80+
// Wrangler would load `.env.<wrangler env>` while we should load `.env.<process.env.NEXTJS_ENV>`
81+
// See https://opennext.js.org/cloudflare/howtos/env-vars
82+
CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV: "false",
7983
},
8084
}
8185
);

0 commit comments

Comments
 (0)