Skip to content

Commit faad6f2

Browse files
Fix asset loading with relative paths
- Change base path to relative './' for better GitHub Pages compatibility - Add 404.html for SPA routing support - Update build configuration for proper asset handling - This should resolve the 404 errors for main.jsx and vite.svg
1 parent 0f94fb4 commit faad6f2

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

public/404.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>JS Learning Lab</title>
7+
<script>
8+
// Redirect to index.html for SPA routing
9+
window.location.href = './index.html';
10+
</script>
11+
</head>
12+
<body>
13+
<p>Redirecting...</p>
14+
</body>
15+
</html>

vite.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@ import react from '@vitejs/plugin-react'
44
// https://vite.dev/config/
55
export default defineConfig({
66
plugins: [react()],
7-
base: '/js-learning-lab/',
7+
base: './',
8+
build: {
9+
outDir: 'dist',
10+
assetsDir: 'assets',
11+
sourcemap: false
12+
}
813
})

0 commit comments

Comments
 (0)