I have created a Sveltekit application which I want to host at non root path like http://localhost:3000/dashboard
My svelte.config.js
is
import adapter from '@sveltejs/adapter-node';
import preprocess from "svelte-preprocess";
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter(),
paths: {
base: '/dashboard',
},
csrf: { checkOrigin: false }
},
preprocess: [
preprocess({
scss: {
prependData: '@use "src/variables.scss" as *;',
},
}),
],
output: {
globalObject: 'this',
},
};
export default config;
I am using images like <img src="/images/logo_new.svg">
I am able to build using command
npm run build
To run I am using command
node build
Now I am able to see my application on http://localhost:3000/dashboard
but images are not able to load. In console I am seeing 404 for all image paths.
My application is trying to open http://localhost:3000/images/logo_new.svg
instead of http://localhost:3000/dashboard/images/logo_new.svg
What is right way to deploy sveltekit application on non root path?