From e4c6f3a730c68871d90b46ff2e9c62a9dfe62533 Mon Sep 17 00:00:00 2001 From: Patrick LaRocque Date: Tue, 31 Dec 2024 16:29:50 -0500 Subject: [PATCH 1/2] Updates for deploying to github pages. --- package.json | 2 +- src/components/App.jsx | 2 +- vite.config.ts | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 1d1e7e9..c1f2c27 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "scripts": { "start": "vite", "production": "json-server --watch src/db.json -p 3000 --host 0.0.0.0 --static build", - "build": "node build", + "build": "vite build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", "lint": "eslint \"**/*.{js,jsx}\"", diff --git a/src/components/App.jsx b/src/components/App.jsx index ca55ec3..94e020e 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -11,7 +11,7 @@ import theme from '../containers/styles/theme'; import { SettingsContext } from '../containers/ContextProvider/SettingsProvider'; import { actionTypes } from '../containers/ContextProvider/reducer'; -const isGhPages = process.env.VITE_GH_PAGES === 'true'; +const isGhPages = process.env.VITE_GH_PAGES.trim() === 'true'; const Router = isGhPages ? HashRouter : BrowserRouter; const redirect = isGhPages ? '/request-generator/#/index' : '/index'; const App = () => { diff --git a/vite.config.ts b/vite.config.ts index 58b9fa7..eee687a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -21,4 +21,8 @@ export default defineConfig({ open: false, host: true }, -}) \ No newline at end of file + build: { + outDir: 'build', + emptyOutDir: true, // also necessary + }, +}) From 9ff37ae67014e6012569024a195d89d4965223f2 Mon Sep 17 00:00:00 2001 From: Patrick LaRocque Date: Tue, 31 Dec 2024 16:35:15 -0500 Subject: [PATCH 2/2] small change to logging --- src/components/App.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/App.jsx b/src/components/App.jsx index 94e020e..de99d55 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -14,6 +14,7 @@ import { actionTypes } from '../containers/ContextProvider/reducer'; const isGhPages = process.env.VITE_GH_PAGES.trim() === 'true'; const Router = isGhPages ? HashRouter : BrowserRouter; const redirect = isGhPages ? '/request-generator/#/index' : '/index'; +console.log('redirect: ' + redirect); const App = () => { const [, dispatch] = React.useContext(SettingsContext); useEffect(() => {