SvelteKit is a modern framework, but by default doesn't work in old non-esm browsers. sveltejs/kit#12, sveltejs/kit#6265
This isn't big problem for webdevelopers, as ES6-modules has excellent browser support.
But for SmartTV development thats another story: A Samsung TV from 2018 (Tizen 4) uses the render engine from January 2017 (Chrome 56) and will never update.
SvelteKit uses the default Vite port 5173 so tvkit serve
can run with minimal configuration as shown in the Readme
When using the static adapter
Nothing special is needed, just build the project as normal:
// svelte.config.js
import adapter from "@sveltejs/adapter-static";
export default {
kit: {
adapter: adapter(),
},
};
and process the output directory with tvkit build
:
// package.json
"scripts": {
"build": "vite build && tvkit build ./build --out ./dist --browser \"Tizen 6, WebOS 6\"",
and deploy the dist
folder to the hosting provider.
// TODO: Figure out how links and reloads could work
When using the node adapter
Similar to the static adapter, but TVKit will detect the build directory is using sveltekit node adapter layout and adapts accordingly.
// package.json
"scripts": {
"build": "vite build && tvkit build ./build --out ./dist --browser \"Tizen 6, WebOS 6\"",
Deploy the dist
folder to a node hosting provider.
When using the vercel adapter
In the project settings use de Framework Preset "SvelteKit" and override for the "Build command": change it from vite build
to npm run build
And update the build script to:
// package.json
"scripts": {
"build": "vite build && tvkit build --browser \"Tizen 6, WebOS 6\" ./.vercel/output --out ./.vercel/output --force",