nuxt-community / dotenv-module

Loads your .env file into your application context
MIT License
495 stars 30 forks source link

env vars are not defined in nuxt layer #78

Closed ehibes closed 9 months ago

ehibes commented 9 months ago

Context

I'm trying to make a Nuxt layer, with a demo folder to extend the base/layer code. So, to launch the project, yarn dev is equivalent to nuxt dev demo

Issue

Env vars from .env file seems to not be read. Console logs returns undefined on nuxt.config.ts of the layer. If I launch the project without targeting the demo folder (nuxt dev), everything works.

https://stackblitz.com/edit/github-yzyan4?file=package.json,nuxt.config.ts

ehibes commented 9 months ago

I found it, .env file must be in the app that extends the layer, not in the layer.