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..de99d55 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -11,9 +11,10 @@ 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'; +console.log('redirect: ' + redirect); const App = () => { const [, dispatch] = React.useContext(SettingsContext); useEffect(() => { 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 + }, +})