Nuxt.js: Allow nuxt build to read production env

Created on 22 Jul 2018  路  7Comments  路  Source: nuxt/nuxt.js

What problem does this feature solve?

Developers don't have to load production env vars and execute nuxt build. Env vars can be directly read from production.

Right now, when i console.log(process.env) from my production (AWS Elastic Beanstalk), the env returned are all my dev environment.

I had to run nuxt build then upload the entire project to AWS EB.

This feature request is available on Nuxt community (#c7427)
feature-request

Most helpful comment

All 7 comments

Good idea, i use build(pm2) in the beta environment, but env === production.

i need to set env using pm2

@aldarund Thanks, but this is not what I need

@gotoin I'm.not sure what u need, but that module do exactly what was asked in initial issue

@gotoin Completely agree with @aldarund, as I am using nuxt-env to achieve exactly this (hosting on Azure, App Settings variables differ for different slots and map to env vars at runtime, builds done on the dev machine and deployed directly to one of the slots). Swapping the slots immediately (of course, there is an app restart in the background as part of slot warm-up) changes what the app sees.

You just has to be careful which variables you allow to be exposed through this module, as they will be available on the client-side as well in that case. So, this module is unusable for anything what is really a secret. Having said that, there is no problem in using the same principle this module uses to expose an env var server-side only.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vadimsg picture vadimsg  路  3Comments

vadimsg picture vadimsg  路  3Comments

bimohxh picture bimohxh  路  3Comments

VincentLoy picture VincentLoy  路  3Comments

uptownhr picture uptownhr  路  3Comments