Skip to content

Commit d9927a8

Browse files
Update broken routing in example, switch to vite
1 parent c24380f commit d9927a8

File tree

6 files changed

+670
-5257
lines changed

6 files changed

+670
-5257
lines changed

example/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<body>
1212
<div id="root"></div>
13-
<script src="./index.tsx"></script>
13+
<script type="module" src="./index.tsx"></script>
1414
</body>
1515

1616
</html>

example/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const A = ({
2424

2525
export const App = () => {
2626
const [path, setPath] = React.useState(window.location.pathname)
27-
React.useEffect(() => history.listen(e => setPath(e.pathname)))
27+
React.useEffect(() => history.listen(e => setPath(e.location.pathname)))
2828

2929
return (
3030
<div style={{padding: '0 20px', maxWidth: '960px', margin: 'auto'}}>

example/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
"build": "parcel build index.html"
99
},
1010
"dependencies": {
11-
"history": "^5.0.0",
12-
"react": ">=15",
13-
"react-app-polyfill": "^2.0.0",
14-
"style.css": "^1.0.0"
11+
"history": "5.1.0",
12+
"react": "17.0.2",
13+
"react-app-polyfill": "2.0.0",
14+
"style.css": "1.0.0"
1515
},
1616
"alias": {
1717
"react": "../node_modules/react",
1818
"react-dom": "../node_modules/react-dom/profiling",
1919
"scheduler/tracing": "../node_modules/scheduler/tracing-profiling"
2020
},
2121
"devDependencies": {
22-
"@types/history": "4.7.8",
23-
"@types/react": "17.0.13",
24-
"@types/react-dom": "17.0.8",
25-
"parcel": "1.12.4",
26-
"typescript": "3.9.10"
22+
"@types/react": "17.0.34",
23+
"@types/react-dom": "17.0.11",
24+
"@vitejs/plugin-react": "1.0.8",
25+
"typescript": "4.4.4",
26+
"vite": "2.6.14"
2727
}
2828
}

example/tsconfig.json

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
{
22
"compilerOptions": {
3-
"allowSyntheticDefaultImports": false,
4-
"target": "es5",
5-
"module": "commonjs",
3+
"target": "es2015",
4+
"lib": ["es2018", "dom"],
5+
"module": "es2020",
66
"jsx": "react",
7-
"moduleResolution": "node",
8-
"noImplicitAny": false,
9-
"noUnusedLocals": false,
10-
"noUnusedParameters": false,
11-
"removeComments": true,
12-
"strictNullChecks": true,
13-
"preserveConstEnums": true,
14-
"sourceMap": true,
15-
"lib": ["es2015", "es2016", "dom"],
16-
"baseUrl": ".",
17-
"types": ["node"]
7+
"moduleResolution": "node"
188
}
199
}

example/vite.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import {defineConfig} from 'vite'
2+
import react from '@vitejs/plugin-react'
3+
4+
export default defineConfig({
5+
plugins: [react()]
6+
})

0 commit comments

Comments
 (0)