Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can`t use prod.env.js variable in proxy config #1524

Open
aaburkov opened this issue Aug 7, 2020 · 0 comments
Open

Can`t use prod.env.js variable in proxy config #1524

aaburkov opened this issue Aug 7, 2020 · 0 comments

Comments

@aaburkov
Copy link

aaburkov commented Aug 7, 2020

prod.env.js

'use strict'
module.exports = {
  NODE_ENV: '"production"',
  ROOT_API: '"/api"'
}

config/index.js

'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path')
const port = 3000 
const apiPort = 4000

module.exports = {
  dev: {
    // Paths
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {
      [process.env.ROOT_API]: {
        target: `http://127.0.0.1:${apiPort}/`,
        changeOrigin: true,
        pathRewrite: {
          ['^' + process.env.ROOT_API]: ''
        }
      }
    },
...

And after build config in proxy object i get

undefined: {
        target: `http://127.0.0.1:4000/`,
        changeOrigin: true,
        pathRewrite: {
          ['^' + undefined ]: ''
        }
      }

How i can use env variables in config files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant