Reputation: 142
I'm having trouble deploying my SvelteKit application built using adapter-netlify. My static assets (images, webfonts, ...) located inside the /static
directory are not included in the build. When I run the app in dev mode (npm run dev
) everything works just fine, however, when I visit the deployed app I'm getting a lot of 404 responses. How can I configure adapter-netlify so that it includes everything inside /static
?
This is my svelte.config.js
:
import adapter from '@sveltejs/adapter-static';
import preprocess from 'svelte-preprocess';
const config = {
preprocess: preprocess(),
kit: {
adapter: adapter(),
prerender: {
default: true
},
files: {
assets: 'static',
lib: 'src/lib'
}
}
};
export default config;
Note: I am not importing the assets as such in my component's script. I'm instead referencing them by their URL (which works fine in dev mode).
I wasn't able to find any resources related to my problem. Thank you in advance for any suggestions!
Upvotes: 0
Views: 1225
Reputation: 1
Sveltekit moves everything in static
folder to the root of the build so you should reference them without static
in the path. So rather than something like <img src="static/image.png">
you'd use <img src="image.png">
Upvotes: 0