summaryrefslogtreecommitdiff
path: root/vue.config.js
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2020-09-03 21:19:28 +0300
committerGunnar Mills <gmills@us.ibm.com>2020-09-25 03:00:26 +0300
commit816d947ef553feacc3d3a5c8e6fc91c8dc2976ba (patch)
tree11135bc8fba51cfec0bbccc20e144e9f1fbb183a /vue.config.js
parent9b22b49232da67bd15e04193006ce881a93265c0 (diff)
downloadwebui-vue-816d947ef553feacc3d3a5c8e6fc91c8dc2976ba.tar.xz
Create separate file for Vue Router routes
Separating routes into its own JS file to allow for easier env customizations. Update store resolve path to make sure right env stores modules are imported in every file. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: I5c646c81fab54085198b2e179be80c954258f51c
Diffstat (limited to 'vue.config.js')
-rw-r--r--vue.config.js26
1 files changed, 14 insertions, 12 deletions
diff --git a/vue.config.js b/vue.config.js
index 53dc6141..ca8e9f08 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -58,22 +58,16 @@ module.exports = {
const hasCustomAppNav =
process.env.CUSTOM_APP_NAV === 'true' ? true : false;
- if (process.env.NODE_ENV === 'production') {
- config.plugins.push(
- new CompressionPlugin({
- deleteOriginalAssets: true
- })
- );
- }
-
if (envName !== undefined) {
if (hasCustomStore) {
- // If env has custom store, resolve store module in src/main.js
- config.resolve.alias['./store$'] = `./env/store/${envName}.js`;
+ // If env has custom store, resolve all store modules. Currently found
+ // in src/router/index.js src/store/api.js and src/main.js
+ config.resolve.alias['./store$'] = `@/env/store/${envName}.js`;
+ config.resolve.alias['../store$'] = `@/env/store/${envName}.js`;
}
if (hasCustomRouter) {
- // If env has custom router, resolve router module in src/main.js
- config.resolve.alias['./router$'] = `./env/router/${envName}.js`;
+ // If env has custom router, resolve routes in src/router/index.js
+ config.resolve.alias['./routes$'] = `@/env/router/${envName}.js`;
}
if (hasCustomAppNav) {
// If env has custom AppNavigation, resolve AppNavigationMixin module in src/components/AppNavigation/AppNavigation.vue
@@ -82,6 +76,14 @@ module.exports = {
] = `@/env/components/AppNavigation/${envName}.js`;
}
}
+
+ if (process.env.NODE_ENV === 'production') {
+ config.plugins.push(
+ new CompressionPlugin({
+ deleteOriginalAssets: true
+ })
+ );
+ }
},
chainWebpack: config => {
if (process.env.NODE_ENV === 'production') {