Skip to content

Instantly share code, notes, and snippets.

@shirakaba
Last active July 8, 2023 03:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save shirakaba/2283ca9f12fcfb3e01a08c41b28b7c02 to your computer and use it in GitHub Desktop.
Save shirakaba/2283ca9f12fcfb3e01a08c41b28b7c02 to your computer and use it in GitHub Desktop.
How to configure Vite from svelte.config.js in SvelteKit projects

SvelteKit

In SvelteKit projects, SvelteKit wraps around Vite.

This example is for configuring path aliases, but you get the idea. There's a kit.vite property in svelte.config.js, and you'd configure vite through there.

https://kit.svelte.dev/faq#aliases

Vite's plugins should be API-compatible with Rollup, to my understanding.

More docs: https://kit.svelte.dev/docs#configuration-vite

Svelte

For regular Svelte projects, you'd probably use Vite directly, apparently "using Vite's CLI commands instead".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment