feat: configure base paths for production deployment

Set basename in router and base in vite config for production environment
Update favicon and fix deploy workflow newline
This commit is contained in:
2025-09-15 22:36:01 +08:00
parent c8083c6540
commit 617ca5ee8b
4 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/onixbyte.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OnixByte React Template</title> <title>OnixByte React Template</title>
</head> </head>
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.6 KiB

+3 -1
View File
@@ -29,6 +29,8 @@ const router = createBrowserRouter([
}, },
], ],
}, },
]) ], {
basename: process.env.NODE_ENV === 'production' ? '/react-template' : '/'
})
export default router export default router
+1
View File
@@ -6,6 +6,7 @@ import tailwindcss from "@tailwindcss/vite"
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react(), tailwindcss()], plugins: [react(), tailwindcss()],
base: process.env.NODE_ENV === 'production' ? '/react-template/' : '/',
resolve: { resolve: {
alias: { alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)), "@": fileURLToPath(new URL("./src", import.meta.url)),