Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does SvelteKit relies on NodeJS?

SvelteKit provides a "skeleton" for multi-page app, of which two features are particularly interesting for me: 1) a routing system (src/routes); 2) server-side rendering.

My question is: does SvelteKit rely on NodeJS? I use Go as backend server, which works well with VueJS frontend. I just simply copy the output of webpack (the dist folder) to my go source tree and compile it into a single executable.

Does that work with SvelteKit?

EDIT

Background: I am primarily a Go programmer. Before I know Svelte, I purely uses Bootstrap + vanilla JS for frontend development. I've tried VueJS, but give up. The purpose of this question is to ask: is it worth to learn SvelteKit or just Svelte?

In another word, SSR is "nice to have" for me. However if the "routing" architecture does not work without Node, then I feel I'd better just go with Svelte, or, is there any other reason to choose SvelteKit?

like image 662
xrfang Avatar asked Jun 29 '26 21:06

xrfang


1 Answers

I think you mean static rendering from

I just simply copy the output of webpack

If you want to do static rendering with SvelteKit, install @sveltejs/adapter-static@next and plug it into your svelte.config.js as import adapter from '@sveltejs/adapter-static';.

You may have to set an extra property, prerender, in the config, that way Svelte knows to do prerendering for any logic in the page, so it can build correctly.

An example svelte.config.js file that does this:

import adapter from '@sveltejs/adapter-static';

/** @type {import('@sveltejs/kit').Config} */
const config = {
    kit: {
        adapter: adapter(),
        prerender: {
            default: true
        }
    }
};

export default config;

That way, when you do npm run build in the directory containing the project, it will output to the build folder.

like image 165
LeoDog896 Avatar answered Jul 01 '26 21:07

LeoDog896



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!