From 995ebfeb3404cec6da10d161436982eeed6daf8b Mon Sep 17 00:00:00 2001 From: zihluwang Date: Mon, 15 Sep 2025 22:57:30 +0800 Subject: [PATCH] build: update base URL and router configuration for custom domain Update Vite config and router basename to use root path for production Add CNAME file for custom domain deployment --- public/CNAME | 1 + src/router/index.tsx | 47 +++++++++++++++++++++++--------------------- vite.config.ts | 2 +- 3 files changed, 27 insertions(+), 23 deletions(-) create mode 100644 public/CNAME diff --git a/public/CNAME b/public/CNAME new file mode 100644 index 0000000..6c8dbc1 --- /dev/null +++ b/public/CNAME @@ -0,0 +1 @@ +onixbyte.dev \ No newline at end of file diff --git a/src/router/index.tsx b/src/router/index.tsx index ca96b7e..be17847 100644 --- a/src/router/index.tsx +++ b/src/router/index.tsx @@ -9,28 +9,31 @@ import ContactPage from "@/page/contact" * Main application router configuration using React Router v6. * Defines all routes and their corresponding components. */ -const router = createBrowserRouter([ +const router = createBrowserRouter( + [ + { + path: "/", + element: , + errorElement: , + children: [ + { + index: true, + element: , + }, + { + path: "about", + element: , + }, + { + path: "contact", + element: , + }, + ], + }, + ], { - path: "/", - element: , - errorElement: , - children: [ - { - index: true, - element: , - }, - { - path: "about", - element: , - }, - { - path: "contact", - element: , - }, - ], - }, -], { - basename: process.env.NODE_ENV === 'production' ? '/react-template' : '/' -}) + basename: "/", + } +) export default router diff --git a/vite.config.ts b/vite.config.ts index aaeb578..45b6aba 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,7 +6,7 @@ import tailwindcss from "@tailwindcss/vite" // https://vite.dev/config/ export default defineConfig({ plugins: [react(), tailwindcss()], - base: process.env.NODE_ENV === 'production' ? '/react-template/' : '/', + base: "/", resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)),