From 9e36f522b94511c1d77335493c09e68975db031c Mon Sep 17 00:00:00 2001 From: Yoshie Muranaka Date: Wed, 5 Feb 2020 07:42:34 -0800 Subject: Add webpack config for env specific builds Add documentation and example files to make environment specific build modifications. - Store any env specific router and store modules in separate env directory Signed-off-by: Yoshie Muranaka Change-Id: I06ff3cb0928707354266dd25b399710847e7fa18 --- vue.config.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'vue.config.js') diff --git a/vue.config.js b/vue.config.js index 12a723d6..882944fa 100644 --- a/vue.config.js +++ b/vue.config.js @@ -26,6 +26,8 @@ module.exports = { }, productionSourceMap: false, configureWebpack: config => { + const envName = process.env.VUE_APP_ENV_NAME; + if (process.env.NODE_ENV === 'production') { config.plugins.push( new CompressionPlugin({ @@ -33,6 +35,12 @@ module.exports = { }) ); } + if (envName !== undefined) { + // Resolve store and router modules in src/main.js + // depending on environment (VUE_APP_ENV_NAME) variable + config.resolve.alias['./store$'] = `./env/store/${envName}.js`; + config.resolve.alias['./router$'] = `./env/router/${envName}.js`; + } }, chainWebpack: config => { if (process.env.NODE_ENV === 'production') { -- cgit v1.2.3