From 545dfc12521abb2cb1475e1ad2c98490b0a36813 Mon Sep 17 00:00:00 2001 From: avo Date: Sun, 27 Oct 2024 13:24:06 -0500 Subject: [PATCH] routes --- package.json | 1 + src/App.tsx | 61 ++++++++++++++++++++++++++------------------------ vite.config.ts | 17 ++++++++++++-- 3 files changed, 48 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index 242717b..9c21e2e 100644 --- a/package.json +++ b/package.json @@ -37,5 +37,6 @@ "typescript-eslint": "^8.10.0", "vite": "^5.4.9" }, + "homepage": "https://avo.github.io/", "packageManager": "yarn@4.5.1" } diff --git a/src/App.tsx b/src/App.tsx index 6724aaa..d7817bf 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -9,35 +9,38 @@ import { baseStyle } from './styles/Base'; import { elementStyle } from './styles/Element'; import { themeStyle } from './styles/Theme'; -const router = createBrowserRouter([ - { - children: [ - { - element: , - index: true, - }, - { - element: , - path: '/about', - }, - { - element: , - path: '/blog', - }, - { - element: , - path: '/error', - }, - { - element: , - path: '*', - }, - ], - element: , - errorElement: , - path: '/', - }, -]); +const router = createBrowserRouter( + [ + { + children: [ + { + element: , + index: true, + }, + { + element: , + path: '/about', + }, + { + element: , + path: '/blog', + }, + { + element: , + path: '/error', + }, + { + element: , + path: '*', + }, + ], + element: , + errorElement: , + path: '/', + }, + ], + { basename: import.meta.env.DEV ? '/' : '/gio/' } +); function App() { return ( diff --git a/vite.config.ts b/vite.config.ts index 98d78a3..590085b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,6 +2,19 @@ import react from '@vitejs/plugin-react'; import { defineConfig } from 'vite'; // https://vitejs.dev/config/ -export default defineConfig({ - plugins: [react({ jsxImportSource: '@emotion/react' })], +// export default defineConfig({ +// plugins: [react({ jsxImportSource: '@emotion/react' })], +// }); + +export default defineConfig(({ command }) => { + const config = { + base: '/', + plugins: [react({ jsxImportSource: '@emotion/react' })], + }; + + if (command !== 'serve') { + config.base = '/gio/'; + } + + return config; });