diff --git a/.changeset/tasty-teeth-do.md b/.changeset/tasty-teeth-do.md new file mode 100644 index 000000000..7f6378f6e --- /dev/null +++ b/.changeset/tasty-teeth-do.md @@ -0,0 +1,5 @@ +--- +"@opennextjs/cloudflare": patch +--- + +wrangler should not load .env files diff --git a/packages/cloudflare/src/cli/utils/run-wrangler.ts b/packages/cloudflare/src/cli/utils/run-wrangler.ts index 9bf4aa0e1..2ecb3cfb9 100644 --- a/packages/cloudflare/src/cli/utils/run-wrangler.ts +++ b/packages/cloudflare/src/cli/utils/run-wrangler.ts @@ -76,6 +76,10 @@ export function runWrangler(options: BuildOptions, args: string[], wranglerOpts: env: { ...process.env, ...(wranglerOpts.logging === "error" ? { WRANGLER_LOG: "error" } : undefined), + // `.env` files are handled by the adapter. + // Wrangler would load `.env.` while we should load `.env.` + // See https://opennext.js.org/cloudflare/howtos/env-vars + CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV: "false", }, } );