Spaces:
Running
Running
Commit ·
cbaba31
1
Parent(s): 8b713eb
route the index.html path that hugging face serves to the app
Browse files- src/hooks.ts +6 -0
src/hooks.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Reroute } from '@sveltejs/kit';
|
| 2 |
+
|
| 3 |
+
/** Hugging Face serves static Spaces at /index.html, which the client router would otherwise 404. */
|
| 4 |
+
export const reroute: Reroute = ({ url }) => {
|
| 5 |
+
if (url.pathname.endsWith('/index.html')) return url.pathname.slice(0, -'index.html'.length);
|
| 6 |
+
};
|