URLs not reflecting base path in SvelteKit + @sveltejs/adapter-static setup #11554
-
| I am building a static website using SvelteKit. It's a static site (I'm using  This leads to some very strange behavior. When clicking on a link, the url of the page sometimes gets added to the current url (resulting in things like  The links are in the  This is the content of the  <script>
    import { base } from '$app/paths';
</script>
<slot />
<p>Go to <a href="{base}/">home</a>, <a href="{base}/page_1">page 1</a> or <a href="{base}/page_2">page 2</a>.</p>This is the  export const prerender = trueAnd this is the  import adapter from '@sveltejs/adapter-static';
/** @type {import('@sveltejs/kit').Config} */
const config = {
	kit: {
		adapter: adapter(),
        paths: {
            base: '/examle-url'
        }
	}
};
export default config;Aside from that I'm using the standard files that are provided after the  What am I doing wrong that causes the wrong build? Or could this be a bug? | 
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
| See https://kit.svelte.dev/docs/migrating-to-sveltekit-2#paths-are-now-relative-by-default | 
Beta Was this translation helpful? Give feedback.
-
| Was stuck on this for hours, to fix: in  const config = {
  kit: {
    paths: { relative: false }
  }
};Maybe this should be mentioned somewhere in the docs about  | 
Beta Was this translation helpful? Give feedback.
Was stuck on this for hours, to fix:
in
svelte.config.jsMaybe this should be mentioned somewhere in the docs about
@sveltejs/adapter-static