I developed and app in SvelteKit, and I wanna deploy it as a static site. This is my SSG adapter configuration I got from the documentation.
const config={
kit: {
adapter: adapter({
// default options are shown. On some platforms
// these options are set automatically — see below
pages: 'build',
assets: 'build',
fallback: undefined,
precompress: false,
strict: false
})
}
};
The problem here is that when I try 'npm run build' it puts up a bunch of files but no HTML or CSS files, also when I try npm run preview
it can't find the main CSS file. If I change strict to true
it gives me an error that I should prerender routes. If I export const prerender = true;
in +page.svelte
it ignores it, I created +page.js
specially for that line but it gives me another error:
node:internal/event_target:1010 process.nextTick(() => { throw err; }); Error: 404 /src/app.css (linked from /)
How do I navigate this?
After many suggestions and many searches, none of the solutions worked. So I simply copied the output files from .svelte-kit folder and uploaded them directly to the server. it took some tweaking in the middle with the linking of some files but it worked out in the end. This method is not recommended, I did this out of sheer frustration.