From 0ba8da34209302b3aebfb972a56545829f21ae4c Mon Sep 17 00:00:00 2001 From: zihluwang Date: Mon, 15 Sep 2025 20:33:51 +0800 Subject: [PATCH] feat(router): add basename configuration for production env Update router configuration to use '/react-template' as basename in production and '/' in development. Also update index.html title to reflect project name. --- index.html | 2 +- src/router/index.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index e4b78ea..6103e3d 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Vite + React + TS + OnixByte React Template
diff --git a/src/router/index.tsx b/src/router/index.tsx index 96ea9e9..ca96b7e 100644 --- a/src/router/index.tsx +++ b/src/router/index.tsx @@ -29,6 +29,8 @@ const router = createBrowserRouter([ }, ], }, -]) +], { + basename: process.env.NODE_ENV === 'production' ? '/react-template' : '/' +}) export default router