Skip to content

Commit 78b6c03

Browse files
committed
chore: resolve error page not found
1 parent 058de62 commit 78b6c03

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

examples/ecommerce-jewellery-store/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@
1717
<body>
1818
<div id="root"></div>
1919
<script type="module" src="/src/main.tsx"></script>
20+
<script>
21+
(() => {
22+
const redirect = sessionStorage.redirect;
23+
delete sessionStorage.redirect;
24+
if (redirect && redirect !== location.href) {
25+
history.replaceState(null, null, redirect);
26+
}
27+
})();
28+
</script>
2029
</body>
2130

2231
</html>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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" />
6+
<title>Page Not Found</title>
7+
<script>
8+
sessionStorage.redirect = location.href;
9+
</script>
10+
<meta http-equiv="refresh" content="0;URL='/'" />
11+
</head>
12+
<body></body>
13+
</html>

examples/ecommerce-jewellery-store/vite.config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineConfig } from 'vite';
22
import react from '@vitejs/plugin-react';
33
import path from 'path';
4+
import { resolve } from 'path';
45
import { fileURLToPath } from 'url';
56

67
const __filename = fileURLToPath(import.meta.url);
@@ -16,6 +17,12 @@ export default defineConfig({
1617
},
1718
},
1819
build: {
19-
outDir: 'build'
20+
outDir: 'build',
21+
rollupOptions: {
22+
input: {
23+
main: resolve(__dirname, "index.html"),
24+
404: resolve(__dirname, "public/404.html"),
25+
},
26+
},
2027
},
2128
});

0 commit comments

Comments
 (0)