Overriding Variable in Dev mode
I am trying to find out, wether there is a way on how I can override a environment variable in Nuxt.
I already looked through the docs (https://nuxt.com/docs/4.x/guide/going-further/runtime-config#environment-variables) and the GitHub issues of Nuxt and Nitro, but can't find anyone with the same issue.
We are using layers and define the layer when building multiple sites:
That way running
We then have NPM scripts like
The problem is now, that defining a ENV variable like that isn't supported in Windows. There is the cross-env package however I was wondering, wether it is possible or would make sense to override variables via a flag.
My basic idea was something like
I already looked through the docs (https://nuxt.com/docs/4.x/guide/going-further/runtime-config#environment-variables) and the GitHub issues of Nuxt and Nitro, but can't find anyone with the same issue.
We are using layers and define the layer when building multiple sites:
That way running
nuxt dev or nuxt build uses by default site1 as the layer.We then have NPM scripts like
npm run dev:site1 → SITE=site1 nuxt dev and npm run dev:site2 → SITE=site2 nuxt dev.The problem is now, that defining a ENV variable like that isn't supported in Windows. There is the cross-env package however I was wondering, wether it is possible or would make sense to override variables via a flag.
My basic idea was something like
nuxt dev -e SITE=site1, similar to how it works with docker. That way it works independent of OS and wouldn't need extra packages.Nuxt
Nuxt provides a runtime config API to expose configuration and secrets within your application.

