Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Vite and TS5 #70

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions web/public/index.html → web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="West Midlands Cycle Data: Interactive Map and Stats"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo96.png" />
<link rel="apple-touch-icon" href="/logo96.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="manifest" href="/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand All @@ -34,6 +34,9 @@
<noscript>You need to enable JavaScript to run this app.</noscript>

<div id="root"></div>

<script type="module" src="/src/index.tsx"></script>

<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
33,114 changes: 4,301 additions & 28,813 deletions web/package-lock.json

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"react-apexcharts": "^1.4.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.11.2",
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
"typescript": "^5.2.0",
"web-vitals": "^3.0.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"start": "vite",
"build": "tsc && vite build",
"serve": "vite preview",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Expand All @@ -42,5 +42,10 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@vitejs/plugin-react": "^4.2.0",
"vite": "^5.0.0",
"vite-tsconfig-paths": "^4.2.1"
}
}
4 changes: 2 additions & 2 deletions web/src/pages/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function About() {
</div>
<img
className={styles.about_box_image}
src={process.env.PUBLIC_URL + "/about/api.png"}
src={"/about/api.png"}
></img>
</a>
</div>
Expand All @@ -89,7 +89,7 @@ function About() {
</div>
<img
className={styles.about_box_image}
src={process.env.PUBLIC_URL + "/about/github.png"}
src={"/about/github.png"}
></img>
</a>
</div>
Expand Down
1 change: 0 additions & 1 deletion web/src/react-app-env.d.ts

This file was deleted.

1 change: 1 addition & 0 deletions web/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
5 changes: 3 additions & 2 deletions web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"compilerOptions": {
"target": "es5",
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"types": ["vite/client"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"module": "ESNext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
Expand Down
15 changes: 15 additions & 0 deletions web/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import viteTsconfigPaths from 'vite-tsconfig-paths';

// https://vitejs.dev/config/
export default defineConfig({
server: {
port: 80,
host: "0.0.0.0",
},
plugins: [
react(),
viteTsconfigPaths(),
],
});