Skip to content

Commit

Permalink
fix: use hashrouter instead browserrouter
Browse files Browse the repository at this point in the history
  • Loading branch information
gregoryduckworth committed Oct 20, 2023
1 parent 1b6ff5b commit 4b0b923
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "testing-playground",
"homepage": "https://nearform.github.io/testing-playground/#/",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"dev": "NODE_ENV=development vite",
"build": "tsc && vite build",
"preview": "vite preview",
"preview": "NODE_ENV=development vite preview",
"prepare": "husky install",
"test": "vitest"
},
Expand Down
8 changes: 4 additions & 4 deletions src/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ThemeProvider } from '@emotion/react'
import * as React from 'react'
import * as ReactDOM from 'react-dom/client'
import { I18nextProvider } from 'react-i18next'
import { BrowserRouter } from 'react-router-dom'
import { HashRouter } from 'react-router-dom'

import i18n from './i18n/i18nConfig'
import Router from './Router'
Expand All @@ -15,11 +15,11 @@ if (rootElement !== null) {
<React.StrictMode>
<I18nextProvider i18n={i18n}>
<ThemeProvider theme={Theme}>
<BrowserRouter basename='/testing-playground'>
<HashRouter basename={import.meta.env.BASE_URL}>
<Router />
</BrowserRouter>
</HashRouter>
</ThemeProvider>
</I18nextProvider>
</React.StrictMode>,
</React.StrictMode>
)
}
4 changes: 4 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"skipLibCheck": true,
"strict": true,
"target": "ESNext",
"types": [
"react",
"vite/client"
],
"useDefineForClassFields": true
},
"include": [
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'

export default defineConfig({
base: '/testing-playground',
base: process.env.NODE_ENV === 'production' ? '/testing-playground/#/' : '/#/',
build: {
minify: false
},
Expand Down

0 comments on commit 4b0b923

Please sign in to comment.