- Use adapter static and add fallback option in svelte.config.js:
adapter: adapter({
fallback: 'index.html'
}),- Configure the paths in svelte.config.js:
paths: {
base: process.argv.includes('dev') ? '' : '/repo-name'
},- Handle any prerendering error:
prerender: {
handleMissingId: 'warn',
// other options
}- Set
prerenderoption to true in root +layout.ts. - Append
basepath to all of internal urls, links and asset loading. - Add .nojekyll file in static folder.
- When using tailwind background with arbiraty image url always prepend the url with
/:
<div class="bg-[url('/img/pagoda.png')]"></div>- If doing an SPA (no prerender), set
ssroption to false on root +layout.ts:
export const ssr = falseSetting ssr to false will make load functions run only in the client.