I have encountered an issue when using the .env file for certain projects in Node, specifically in the context of Nuxt3. The current workaround is to run Nuxt3 using node -r dotenv/config .output/server/index.mjs via PM2. However, this approach does not fully integrate "the nuxt" way.
- The application should be able to read the .env file variables and apply them during execution.
- Users should be able to modify variables, such as the PORT number, directly in the .env file.
-The .env file variables are not automatically added during the node execution.
- Nuxt Users have to manually provide variables like the PORT number in the start command.
- It would be beneficial to have the PORT number and other variables automatically added from the .env file.
- Improve the integration of .env files in Nuxt3 projects with PM2, allowing for seamless usage and configuration.
Example script to add to .sh file
#!/usr/bin/env sh # Load variables from .env file. (only need to add the path to site dir here) export $(cat ./.env | grep -v ^# | xargs) >/dev/null
// Talk to Ling for details.
NODEJS: PM2 -Improve .env file support and integration in node/Nuxt3 projects
Dennis moved item to board Planned6 months ago
Dennis moved item to board Under review6 months ago
SMIT. moved item to project Site Level Requests7 months ago
SMIT. created the item7 months ago