Socket
Socket
Sign inDemoInstall

@sveltejs/vite-plugin-svelte

Package Overview
Dependencies
181
Maintainers
4
Versions
102
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @sveltejs/vite-plugin-svelte

The official [Svelte](https://svelte.dev) plugin for [Vite](https://vitejs.dev).


Version published
Maintainers
4
Created

Package description

What is @sveltejs/vite-plugin-svelte?

@sveltejs/vite-plugin-svelte is a Vite plugin that provides seamless integration with Svelte, a modern JavaScript framework for building user interfaces. This plugin allows developers to use Svelte with Vite, leveraging Vite's fast build times and hot module replacement (HMR) capabilities.

What are @sveltejs/vite-plugin-svelte's main functionalities?

Basic Setup

This code demonstrates how to include the @sveltejs/vite-plugin-svelte plugin in a Vite configuration file. This basic setup allows you to start using Svelte with Vite.

```json
{
  "plugins": [
    require('@sveltejs/vite-plugin-svelte')()
  ]
}
```

Hot Module Replacement (HMR)

This code sample shows how to enable Hot Module Replacement (HMR) with the @sveltejs/vite-plugin-svelte plugin. HMR allows you to see changes in your Svelte components instantly without a full page reload.

```json
{
  "plugins": [
    require('@sveltejs/vite-plugin-svelte')({
      hot: true
    })
  ]
}
```

Custom Svelte Compiler Options

This example demonstrates how to pass custom compiler options to the Svelte compiler using the @sveltejs/vite-plugin-svelte plugin. In this case, the `dev` option is set to `true` to enable development mode.

```json
{
  "plugins": [
    require('@sveltejs/vite-plugin-svelte')({
      compilerOptions: {
        dev: true
      }
    })
  ]
}
```

Other packages similar to @sveltejs/vite-plugin-svelte

Readme

Source

@sveltejs/vite-plugin-svelte

The official Svelte plugin for Vite.

Usage

// vite.config.js
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';

export default defineConfig({
  plugins: [
    svelte({
      /* plugin options */
    })
  ]
});

Documentation

License

MIT

Keywords

FAQs

Last updated on 22 Sep 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc