-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
22 lines (19 loc) · 793 Bytes
/
Copy pathvite.config.ts
File metadata and controls
22 lines (19 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { defineConfig } from "vitest/config";
type NodeishGlobal = { process?: { env?: Record<string, string | undefined> } };
/** Project Pages live at `https://<user>.github.io/<repo>/` — must end with `/`. */
function githubPagesBase(): string {
const raw = (globalThis as unknown as NodeishGlobal).process?.env?.GITHUB_PAGES_BASE?.trim();
if (raw) {
const withLeading = raw.startsWith("/") ? raw : `/${raw}`;
return withLeading.endsWith("/") ? withLeading : `${withLeading}/`;
}
// Local `yarn build:pages` when env is unset (matches this repo’s remote name).
return "/three.js-animations/";
}
export default defineConfig(({ mode }) => ({
base: mode === "github-pages" ? githubPagesBase() : "/",
test: {
environment: "jsdom",
globals: false,
},
}));