diff --git a/.github/workflows/vue-publish.yml b/.github/workflows/vue-publish.yml index 4acf5d8..c780a76 100644 --- a/.github/workflows/vue-publish.yml +++ b/.github/workflows/vue-publish.yml @@ -37,6 +37,8 @@ jobs: run: npm ci - name: Build run: npm run build + env: + BASE_URL: /Family-Tree-Graph/ - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: diff --git a/vite.config.ts b/vite.config.ts index 5c45e1d..73a1fbf 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,16 +1,19 @@ -import { fileURLToPath, URL } from 'node:url' +import { fileURLToPath, URL } from 'node:url'; -import { defineConfig } from 'vite' -import vue from '@vitejs/plugin-vue' +import { defineConfig, UserConfig } from 'vite'; +import vue from '@vitejs/plugin-vue'; -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - vue(), - ], +const config: UserConfig = { + plugins: [vue()], resolve: { alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)) - } - } -}) + '@': fileURLToPath(new URL('./src', import.meta.url)), + }, + }, +}; + +if (process.env.BASE_URL) { + config.base = process.env.BASE_URL; +} + +export default defineConfig(config);