-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support .env
file for production / preview node preset
#1492
Comments
For cloudflare presets previews, there's builtin dotenv supports too, but the file needs to be named |
Good to know! My aim for this issue was mainly for Node presets but having other preset previews in mind, we might either leverage possible |
Currently, append |
Note that this feature should be coming to Node natively in 20.6. |
what if running in serverless environment rather than node server in future? |
Turns out the strong competition provided by deno and bun is working. We might have TS support in node at this rate 🤞🏽 |
Hi! Could this behavior be clarified or added to the Nitro documentation? I’ve spent hours trying to figure out why
It would be really helpful to have clear guidance on how to properly handle .env variables in the production build (for local testing or deployment), especially since this seems like a common issue. Thank you for your time! |
for me this works for now: |
It is quite often required to test production Node.js preset outputs with dotenv file. I am thinking of 3 possible ways:
node -r require/dotenv .output/server/index.mjs
(user needs dotenv local dependency)Need to check how much is actual runtime overhead of dotenv (it seems as low as 5KB).
Also worth to node that, the "local" kind presets (Bun and Deno) both already have built-in dotenv support via CLI args. And there is an ongoing discussion within Node.js team to make it build-in feature..
The text was updated successfully, but these errors were encountered: