I am experimenting with dynamic routing on static site hosting services like github pages. I understand that normally you wouldn't want to do this and may have to jump through hoops to get it working.
I am using onMount function from svelte to load the data on the client side. I have two dynamic urls, /qna?id=1, this works but the other url /blog/[slug] fails. When I navigate to a url like /blog/hello, it returns the following error in console: Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: https://mohit2152sharma.github.io/_app/immutable/entry/start.a84ced15.js. My guess is this being caused by some path issue. If anyone has encountered similar issue, would appreciate your help and time.
(You can check out the repo here: https://github.com/mohit2152sharma/svelte-mpa-example)
PS: I have followed almost all the steps mentioned in the docs, like setting up csr=true and ssr=false, using adapter-static, using fallback='404.html' which is same as that of github pages error page.
PPS: If I deploy the same project on vercel it works, the only changes I make while deploying are change the adapter to adapter-vercel and use the defaults for adapter.
It looks like you are not configuring or using the repository as
basepath correctly. The repository name is missing between domain and_appin the requested path:This much is noted in the GitHub Pages specific docs:
Also think there used to be something in the docs about issues around Jekyll and directories prefixed with
_. By default, code ends up in_appas seen in the error and that was not be served. Maybe not an issue anymore.Would disable Jekyll by putting a
.nojekyllinto the root of the pages branch and change the output directory (appDir) to something different.