@sveltejs/vite-plugin-svelte
The official Svelte plugin for Vite.
Installation
npm install --save-dev @sveltejs/vite-plugin-svelte
Usage
// vite.config.js
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
export default defineConfig({
plugins: [
svelte({
// plugin options
})
]
});
Documentation
Packages
| Package | Changelog | | ----------------------------------------------------------- | ----------------------------------------------------- | | @sveltejs/vite-plugin-svelte | Changelog |
Got a question? / Need help?
Join the Svelte Discord server!
Development
All scripts work from monorepo-root. The plugins are unbundled esm, a build step is not required while developing locally, but restarting local dev-servers can be needed to apply changes.
pnpm ito install dependenciespnpm playwright install chromiumto install required playwright browser binaries via local playwright-core
playwright-core with a bin alias to playwright via package.json script
> Calling pnpm dlx playwright install chromium will not work.
pnpm checkandpnpm:testto validate changespnpm formatto format source codepnpm test:unit,pnpm test:serveorpnpm test:buildto run a subset of testspnpm testto focus a specific testsuitepnpm changesetto generate a changesetpnpm generate:typesto generate public types from jsdoc (this is required when changing types and validated in ci)
Credits
- Svelte and Vite creators, maintainers and contributors
- rixo - without svelte-hmr and your support this would not have been possible
- intrnl - initial inspiration from https://github.com/intrnl/vite-plugin-svelte