From 24ede1607656930ad25a6c80b4b330acedd955ab Mon Sep 17 00:00:00 2001 From: sinsong Date: Wed, 28 Jun 2023 17:47:13 +0800 Subject: [PATCH] fix frontend router url base --- frontend/src/router.js | 2 +- frontend/vite.config.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/router.js b/frontend/src/router.js index b1836e1..c797942 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -4,7 +4,7 @@ import Index from './views/Index.vue' import Package from './views/Package.vue' const router = createRouter({ - history: createWebHistory(), + history: createWebHistory(__WEBSITE_BASE__), routes: [ { path: '/', component: Index }, { path: '/:packageName', component: Package } diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 8aa6824..62fe209 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -9,6 +9,8 @@ export default defineConfig(({command}) => { return { plugins: [ replace({ // production / development environment api base + __WEBSITE_BASE__: command === 'build' ? JSON.stringify('/packages') + : JSON.stringify(''), __API_BASE__: command === 'build' ? JSON.stringify('https://bioarchlinux.org') : JSON.stringify(''), preventAssignment: true,