mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#407
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/234
Author: @southpolesteve
Created: 3/3/2026
Status: ✅ Merged
Merged: 3/3/2026
Merged by: @southpolesteve
Base:
main← Head:fix/dotenv-loading📝 Commits (1)
2e32dc9fix: load .env files into process.env before config evaluation📊 Changes
2 files changed (+143 additions, -2 deletions)
View changed files
📝
packages/vinext/src/index.ts(+16 -2)📝
tests/features.test.ts(+127 -0)📄 Description
Summary
Fixes #228. vinext was not loading
.envfiles, so environment variables defined in.envwere unavailable everywhere: server-side code (getServerSideProps, API routes, server components),NEXT_PUBLIC_*client bundle defines, andnext.config.jsevaluation.loadEnv()early in theconfighook (beforeloadNextConfig()) with an empty prefix to load all.envvars intoprocess.env, matching Next.js behaviorprocess.envvalues (system env takes precedence over.envfiles)envDirconfig optionNEXT_PUBLIC_*define injection and server-sideprocess.envaccessChanges
packages/vinext/src/index.ts(the fix, 12 lines):loadEnvfrom Viteconfighook, callloadEnv(mode, envDir, "")and merge results intoprocess.envbefore config loadingtests/features.test.ts(reproduction tests):.envfile containingNEXT_PUBLIC_APP_NAME,SERVER_ONLY_SECRET, andBETTER_AUTH_URLNEXT_PUBLIC_*vars appear in Vite'sconfig.definemapgetServerSidePropscan read all.envvars viaprocess.env🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.