Skip to content

Commit

Permalink
Merge pull request #143 from mcode/connectathon_2025-01_2
Browse files Browse the repository at this point in the history
Fix environment and vite build
  • Loading branch information
smalho01 authored Jan 6, 2025
2 parents 524ccbd + 9ff37ae commit d688aef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"",
Expand Down
3 changes: 2 additions & 1 deletion src/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
6 changes: 5 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ export default defineConfig({
open: false,
host: true
},
})
build: {
outDir: 'build',
emptyOutDir: true, // also necessary
},
})

0 comments on commit d688aef

Please sign in to comment.