[Vuejs]-Associate .env file with vue.config.js

-1👍

You need to use a package like dotenv to read the data from the .env file and use it in command-line.

I personally use something like this.

cmd:

npm run VUE_CONFIG=foo

js:

if (process.env.VUE_CONFIG === 'foo') {
  require('foo.js')
} else {
  require('bar.js')
}

Leave a comment