Using nuxi --dotenv .env.staging
not working as expected inside NX monorepo
#444
Labels
nuxi --dotenv .env.staging
not working as expected inside NX monorepo
#444
Environment
root nx project
Darwin
v20.12.2
-
3.12.0
-
[email protected]
-
-
-
-
apps/backend project
Darwin
v20.12.2
3.12.2
3.12.0
-
[email protected]
-
devtools
,runtimeConfig
-
-
Reproduction
stackblitz.com/github/L422Y/nuxt-nx-bug
github.com/L422Y/nuxt-nx-bug
Describe the bug
We have a Nuxt app that is part of a Nx workspace. There is a
.env
and a.env.staging
file in the root of theapps/backend
Nuxt app. The.env.staging
file should be used when running thedev:staging
task.The problem is that when the
dev:staging
task is run, the.env
file is used instead of the.env.staging
file, even though the appropriate command is run in the correct directory (or it appears to be).When the
nuxi dev --dotenv .env.staging
command is run manually in theapps/backend
directory, it works as expected.Not sure if this is a bug in Nx, Nuxt, or something else.
Steps to reproduce
pnpm install
Regular dev mode (works)
pnpx nx run backend:dev
nuxt dev
is run.env / default
as expectedStaging dev mode (doesn't work)
pnpx nx run backend:dev:staging
nuxi dev --dotenv .env.staging
is run.env / default
instead of.env.staging / staging
Manually running the staging command (works)
cd apps/backend
nuxi dev --dotenv .env.staging
.env.staging / staging
as expectedAdditional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: