Missing NODE_ENV in nuxt
does nuxt has an alternative to
config.NODE_ENV === 'development'
?
I mean, how can I tell if Im in local devlopment server or production build?11 Replies
I'm using process.env.NODE_ENV in nuxt.config
yes, there is π
in the config you can use $production and $development (top-level) to set different values
Even recorded a video about that releasing tomorrow π
That's weird.. when trying to access config.NODE_ENV it's undefined. Does process.env.NODE_ENV will work instead?
@DANANZ M1 config.NODE_ENV is not a thing
https://www.youtube.com/watch?v=DFZI2iVCrNc <- try this π
Alexander Lichter
YouTube
π² An environment-aware Nuxt Configuration
π¬Finally your app is in production - amazing! But how can we ensure that certain configurations or even whole modules are only loaded in dev, or only in production? Would it be even possible to change the nuxt configuration for test environments? A common way is using process.env.NODE_ENV - but luckily, Nuxt provides a more descriptive and foolp...
You actually just posted a video about it π
Keep on with the great content! Love it π―
Got my answer thanks!
I told you I will π
Glad to hear you enjoy my content π
Got my answer thanks!Awesome! π
when I use this in the test it doesn't work, I use build and when I run nuxt it changes the env to production and in the log there is this message
WARN Changing NODE_ENV from test to production, to avoid unintended behavior.
That's on purpose... I've had the github issue related to that recently. Gist is: It will always be production when running a production build.
yes and no. I also mentioned that in
but also there is https://github.com/nuxt/cli/issues/357
GitHub
Load nuxt config with different
envName
for env-specific configs ...Hey all π c12 provides us with the amazing opportunity to add env-specific configs to the nuxt config (also covered in my video), therefore relying on NODE_ENV by default. While it is technically p...