- 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
prerender
option to true in root +layout.ts. - Append
base
path 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
ssr
option to false on root +layout.ts:
export const ssr = false
Setting ssr to false will make load functions run only in the client.