Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5054

config.ts only returns the first object in nuxt

$
0
0

I have this config.ts file:

const config = {  staging:{    baseUrl: 'someUrls/stag',    authEndpointUrl: '',    pubnubEndpointUrl: ''  },  development: {    baseUrl: 'someUrl/dev',    authEndpointUrl: '',    pubnubEndpointUrl: ''  },  production: {    baseUrl: 'someUrl/prod',    authEndpointUrl: '',    pubnubEndpointUrl: ''  }}const nodeEnv = process.env.NODE_ENV ;module.exports = config[nodeEnv]

and this is my nuxt.config.js:

import config from './config.ts';...  env:{    config  },...

in my app if I use process.env.config.baseUrl it only returns the first object's baseUrl: 'someUrls/stag'. If I change the position of staginganddevelopmentin myconfig.tsit returnsbaseUrl: 'someUrl/dev'(again the first object). How can I grab the baseUrl from different objects that I have likeproduction`?

I tried process.env.config.production.baseUrl but it returns null! How can I access different objects in my config.ts file?


Viewing all articles
Browse latest Browse all 5054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>