We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 217cb84 commit 6e44c6fCopy full SHA for 6e44c6f
1 file changed
vite.config.js
@@ -1,7 +1,25 @@
1
import { defineConfig } from "vite";
2
import react from "@vitejs/plugin-react";
3
4
+function getBasePath() {
5
+ const repository = process.env.GITHUB_REPOSITORY;
6
+
7
+ if (!repository) {
8
+ return "/";
9
+ }
10
11
+ const [owner, repo] = repository.split("/");
12
13
+ if (!owner || !repo) {
14
15
16
17
+ const expectedRootRepo = `${owner.toLowerCase()}.github.io`;
18
19
+ return repo.toLowerCase() === expectedRootRepo ? "/" : `/${repo}/`;
20
+}
21
22
export default defineConfig({
- base: "/",
23
+ base: getBasePath(),
24
plugins: [react()],
25
});
0 commit comments