electron-vite-sveltekit-template

A minimal Electron application with TypeScript + SvelteKit + Bytenode

How it works?

Template utilizes electron-vite for its ability to bundle & compile node.js (main & renderer files) to V8 Bytecode. Template doesn't use renderer part of electron-vite, but rather embeds SvelteKit into the project as sub-project in src/renderer directory with it's own dependencies. SvelteKit is configured with adapter-static to build SPA (Single Page Application) with static HTML/CSS/JS. Esentially it gives the best of both worlds:

Project Setup

Install

$ npm install # installs dependencies of `electron-vite`
$ cd src/renderer && npm install # installs dependencies of SvelteKit
$ cd ../../ # gets back to the source directory

Development

Quick start:

$ npm run dev # command starts 2 subcommands in parallel using `concurrently` npm package

If you need new dependencies for SvelteKit:

$ cd src/renderer # navigate to SvelteKit directory & do things from there

(!!!) Don't forget to go back to source directory with cd ../../ after you installed necessary dependencies.

Build

# For windows
$ npm run build:win

# For macOS
$ npm run build:mac

# For Linux
$ npm run build:linux

Top categories

svelte logo

Want a Svelte site built?

Hire a Svelte developer
Loading Svelte Themes