I\'ve used official Webpack template for Vue.js. It uses separate configuration for different environments. They offer test, development and production. However, I need another
PROD: config/prod.env.js
append your VAR='"value"'
'use strict'
module.exports = {
NODE_ENV: '"production"',
API_URL: '"https://production URL"'
}
DEV: config/dev.env.js
append your VAR='"value"'
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
API_URL: '"http://localhost"'
})
Your variable will available as process.env.API_URL
or process.env.VAR_NAME