Nuxt SSR and .env

If you are using runtime config with Nuxt (see Runtime Config · Nuxt Advanced), in a production environment Nuxt will not load from .env, it will only pull from platform environment variables.

The only way I can see to do that with Cleavr is to add the .env to the pm2 config in build settings. But that means I’m managing environment variables in two places (in two different formats) because Nuxt still uses the .env during the build process (I think).

Is there a better way to do this or is this it? I suppose the .env doesn’t change a lot but it’s still a footgun imho.

Hello @interfacelab and welcome to the Cleavr forum!

I assume you’re using Nuxt v3? They made some changes around using .env in prod as you mentioned. You can add needed variables to the PM2 Ecosystem environment section for the time being as we come up with a solution to better manage them.