Skip to content

Commit 43bf30d

Browse files
committed
Update vite.config.js
1 parent 5ccbe54 commit 43bf30d

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

vite.config.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
import { defineConfig } from 'vite'
22
import react from '@vitejs/plugin-react'
33

4-
/** @param {string} raw */
5-
function normalizeBase(raw) {
6-
const s = (raw || '/').trim()
7-
if (s === '' || s === '/') return '/'
8-
const withSlash = s.startsWith('/') ? s : `/${s}`
9-
return withSlash.endsWith('/') ? withSlash : `${withSlash}/`
10-
}
4+
// Default build is portable/local-download friendly.
5+
// For GitHub Pages, build with:
6+
// VITE_BASE=/publish-to-github/ npm run build
117

12-
// GitHub project pages live under /<repo>/ (e.g. https://user.github.io/publish-to-github/).
13-
// Build with: VITE_BASE=/your-repo-name/ npm run build
14-
const base = normalizeBase(process.env.VITE_BASE || '/')
15-
16-
// https://vite.dev/config/
178
export default defineConfig({
18-
base,
9+
base: process.env.VITE_BASE || './',
1910
plugins: [react()],
20-
})
11+
})

0 commit comments

Comments
 (0)