Skip to content

Commit 3ec05e3

Browse files
committed
fix: default vite base to / for Vercel
compatibility
1 parent 113c623 commit 3ec05e3

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

vite.config.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import react from '@vitejs/plugin-react'
33

44
// https://vite.dev/config/
55
//
6-
// `base` must match the path the site is served from. On GitHub Pages that's
7-
// `/<repo-name>/`. The Pages deploy workflow sets VITE_BASE to the correct
8-
// value so renames of the repo don't silently break asset URLs.
6+
// `base` must match the path the site is served from.
7+
// - Vercel (and local dev): served from `/`, so base defaults to `/`
8+
// - GitHub Pages: served from `/<repo-name>/`. The Pages deploy workflow sets
9+
// VITE_BASE to the correct value so renames don't silently break asset URLs.
910
export default defineConfig(({ command }) => ({
1011
plugins: [react()],
11-
base: command === 'build' ? (process.env.VITE_BASE || '/teams-shell/') : '/',
12+
base: command === 'build' ? (process.env.VITE_BASE || '/') : '/',
1213
}))

0 commit comments

Comments
 (0)