Skip to content

Commit

Permalink
refact: better BASE_PATH handling
Browse files Browse the repository at this point in the history
  • Loading branch information
prncss-xyz committed Jul 20, 2024
1 parent c005dbd commit a7a19aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/page.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build
- run: echo BASE_PATH=$(basename $GITHUB_REPOSITORY) > .env
- name: Build
working-directory: packages/web
run: pnpm run build
Expand Down
10 changes: 2 additions & 8 deletions packages/web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@ import { TanStackRouterVite } from '@tanstack/router-plugin/vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'

function getBasePath() {
const repo = process.env.GITHUB_REPOSITORY
if (!repo) return undefined
const [, name] = repo.split('/')
if (!name) return undefined
return `/${name}`
}
console.log('>>> BASE_PATH: %s', process.env.BASE_PATH)

// https://vitejs.dev/config/
export default defineConfig({
base: getBasePath(),
base: process.env.BASE_PATH,
plugins: [TanStackRouterVite(), react()],
resolve: {
alias: {
Expand Down

0 comments on commit a7a19aa

Please sign in to comment.