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 <yoshiemuranaka@gmail.com>
Change-Id: I06ff3cb0928707354266dd25b399710847e7fa18
diff --git a/vue.config.js b/vue.config.js
index 12a723d..882944f 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -26,6 +26,8 @@
},
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 @@
})
);
}
+ 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') {