https://github.com/sveltejs/vite-plugin-svelte
Svelte plugin for https://vite.dev
https://github.com/sveltejs/vite-plugin-svelte
svelte vite vite-plugin
Last synced: 6 months ago
JSON representation
Svelte plugin for https://vite.dev
- Host: GitHub
- URL: https://github.com/sveltejs/vite-plugin-svelte
- Owner: sveltejs
- License: mit
- Created: 2021-03-16T20:54:27.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-04-22T19:26:18.000Z (about 1 year ago)
- Last Synced: 2025-04-23T23:17:01.814Z (about 1 year ago)
- Topics: svelte, vite, vite-plugin
- Language: JavaScript
- Homepage:
- Size: 6.02 MB
- Stars: 910
- Watchers: 14
- Forks: 114
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-vite - vite-plugin-svelte - Adds Svelte support. Official plugin of Svelte team. (Plugins / Svelte)
- awesome-vite - vite-plugin-svelte - Adds Svelte support. Official plugin of Svelte team. (Plugins / Svelte)
README
# @sveltejs/vite-plugin-svelte
[](https://www.npmjs.com/package/@sveltejs/vite-plugin-svelte)
[](https://github.com/sveltejs/vite-plugin-svelte/actions/workflows/ci.yml)
[](https://svelte.dev/chat)
The official [Svelte](https://svelte.dev) plugin for [Vite](https://vitejs.dev).
## Installation
```bash
npm install --save-dev @sveltejs/vite-plugin-svelte
```
## Usage
```js
// vite.config.js
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
export default defineConfig({
plugins: [
svelte({
/* plugin options */
})
]
});
```
## Documentation
- [Plugin options](./docs/config.md)
- [Svelte Inspector](./docs/inspector.md)
- [FAQ](./docs/faq.md)
## Packages
| Package | Changelog |
| ------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [@sveltejs/vite-plugin-svelte](packages/vite-plugin-svelte) | [Changelog](packages/vite-plugin-svelte/CHANGELOG.md) |
| [@sveltejs/vite-plugin-svelte-inspector](packages/vite-plugin-svelte-inspector) | [Changelog](packages/vite-plugin-svelte-inspector/CHANGELOG.md) |
## Got a question? / Need help?
Join the [Svelte Discord server](https://svelte.dev/chat)!
## 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 i` to install dependencies
- `pnpm playwright install chromium` to install required playwright browser binaries via local playwright-core
> **NOTE**
> This repo uses `playwright-core` with a bin alias to `playwright` via package.json script
> Calling `pnpm dlx playwright install chromium` will not work.
- `pnpm check` and `pnpm:test` to validate changes
- `pnpm format` to format source code
- `pnpm test:unit`, `pnpm test:serve` or `pnpm test:build` to run a subset of tests
- `pnpm test ` to focus a specific testsuite
- `pnpm changeset` to generate a changeset
- `pnpm generate:types` to generate public types from jsdoc (this is required when changing types and validated in ci)
## Credits
- [Svelte](https://svelte.dev) and [Vite](https://github.com/vitejs/vite#readme) creators, maintainers and contributors
- [rixo](https://github.com/rixo) - without svelte-hmr and your support this would not have been possible
- [intrnl](https://github.com/intrnl) - initial inspiration from https://github.com/intrnl/vite-plugin-svelte
## License
[MIT](./LICENSE)