proxy target does not resolve process.env.ROOT_API
-
Hi,
I just realized that I cannot use process.env in quasar.conf.js. I was trying to set the proxy via an env variable set via @quasar/qenv.
My conf was:
devServer: { proxy: { '/media': { // target: process.env.ROOT_API, // this doesn not work target: 'http://127.0.0.1:8000', changeOrigin: true, logLevel: 'debug' } },
Is there some more steps I should do to use process.env in quasar.conf.js (it’s working correctly in boot file in axios)?
thanks in advance
sandro -
@sandroden did you check this out yet? https://quasar.dev/quasar-cli/cli-documentation/handling-process-env#Adding-to-process.env
-
Thanks, I read it when but clearly w/o enough attention… I tested it now and in fact within
quasar.conf.js
process.env
sees already the variables. So the problem seems related to qenv that doesn’t propagate the env variable early enough. Do I interpret it correctly? -
I ran into this issue as well. I did this at the top of quasar.conf.js. You then can access your env on the new variable. Sorry for necro just thought it might help someone.
const envFile = require('./.quasar.env.json') const env = envFile[process.env.QENV]