Awesome
vite-plugin-svelte
Deprecated
Use the official sveltejs/vite-plugin-svelte for Vite 2.0+ instead.
Svelte integration for Vite, a fast web dev build tool.
Setup
- Add this plugin as a dev dependency
- npm:
npm install --save-dev vite-plugin-svelte
- pnpm:
pnpm install --save-dev vite-plugin-svelte
- yarn:
yarn add --dev vite-plugin-svelte
- npm:
- Add
svelte
as a regular dependency- npm:
npm install svelte
- pnpm:
pnpm install svelte
- yarn:
yarn add svelte
- npm:
- Add it into your
vite.config.js
fileimport { svelte } from 'vite-plugin-svelte'; export default { plugins: [ // These options are optional, you don't have to configure them manually, // for the most part. svelte({ // Svelte compiler options compilerOptions: {}, // Svelte HMR options, pass false to disable hmrOptions: {}, // Svelte preprocessors preprocess: [], // Plugin options pluginsOptions: {}, }), ], };
Recommendations
- Dedupe
svelte
dependency
This can be done with therollupDedupe
option.export default { plugins: [ // ... ], rollupDedupe: ['svelte'], };