[GH-ISSUE #24] Load dotenv files automatically or provide migration guide #7

Closed
opened 2026-05-06 12:36:25 +02:00 by BreizhHardware · 3 comments

Originally created by @wojtekmaj on GitHub (Feb 24, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/24

Either:

  • Load dotenv files automatically like Next.js does (.env.local, and so on), or:
  • Provide migration guide on how to re-implement this on top of Vite
Originally created by @wojtekmaj on GitHub (Feb 24, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/24 Either: - Load dotenv files automatically like Next.js does (.env.local, and so on), or: - Provide migration guide on how to re-implement this on top of Vite
Author
Owner

@wesleymatosdev commented on GitHub (Feb 24, 2026):

https://vite.dev/guide/env-and-mode#env-files this does not work @wojtekmaj?

<!-- gh-comment-id:3955348473 --> @wesleymatosdev commented on GitHub (Feb 24, 2026): https://vite.dev/guide/env-and-mode#env-files this does not work @wojtekmaj?
Author
Owner

@wojtekmaj commented on GitHub (Feb 24, 2026):

Nope. As soon as I accessed the page after dev server has started, a crash (null check on missing env variable) occurred.

Changing the dev command to:

node --env-file=.env.local node_modules/.bin/vinext dev

worked around the issue.

<!-- gh-comment-id:3955362282 --> @wojtekmaj commented on GitHub (Feb 24, 2026): Nope. As soon as I accessed the page after dev server has started, a crash (null check on missing env variable) occurred. Changing the dev command to: ``` node --env-file=.env.local node_modules/.bin/vinext dev ``` worked around the issue.
Author
Owner

@niicojs commented on GitHub (Feb 26, 2026):

I'm still not seeing process.env populated in my tests.
node / latest nextjs / latest vinext / windows

<!-- gh-comment-id:3964432880 --> @niicojs commented on GitHub (Feb 26, 2026): I'm still not seeing process.env populated in my tests. node / latest nextjs / latest vinext / windows
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#7
No description provided.