whatisgithub

What is rollup-plugin-svelte?

sveltejs/rollup-plugin-svelte — explained in plain English

Analysis updated 2026-07-07 · repo last pushed 2026-05-20

516JavaScriptAudience · developerComplexity · 2/5MaintainedLicenseSetup · easy

In one sentence

A plugin that lets Rollup bundle Svelte components by compiling them into standard JavaScript and CSS. Mainly for existing Rollup projects, new projects should use Vite or SvelteKit instead.

Mindmap

mindmap
  root((repo))
    What it does
      Compiles Svelte components
      Outputs JS and CSS
      Filters files to process
    Tech stack
      JavaScript
      Rollup
      Svelte
    Use cases
      Add Svelte to Rollup apps
      Bundle shared Svelte libraries
      Gradual Svelte migration
    Audience
      Existing Rollup users
      Library authors
      Maintenance teams
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Gradually introduce Svelte components into an existing web application that already uses Rollup.

USE CASE 2

Import and compile third-party Svelte components from shared packages for a smaller output.

USE CASE 3

Configure CSS handling to either extract styles into separate files or inject them via JavaScript.

What is it built with?

JavaScriptRollupSvelte

How does it compare?

sveltejs/rollup-plugin-sveltetypicode/fetchivaljuliangarnier/3d-hartwig-chess-set
Stars516520537
LanguageJavaScriptJavaScriptJavaScript
Last pushed2026-05-202018-12-062023-03-31
MaintenanceMaintainedDormantDormant
Setup difficultyeasyeasyeasy
Complexity2/52/52/5
Audiencedeveloperdeveloperdesigner

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Requires an existing Rollup configuration and Svelte installed as a dependency in your project.

This project uses the MIT license, meaning you can use, modify, and distribute it freely for any purpose, including commercially, as long as you include the copyright notice.

So what is it?

Rollup-plugin-svelte is a bridge between two tools: Svelte, a framework for building web interfaces, and Rollup, a tool that bundles JavaScript files together for deployment. On its own, Rollup doesn't understand Svelte's special component files. This plugin teaches Rollup how to read those files and translate them into standard JavaScript and CSS that web browsers can run. At a high level, when you write a Svelte component (a file that combines HTML, CSS, and JavaScript in one place), it needs to be compiled into plain code before it reaches a user's browser. You plug this tool into your Rollup configuration, and every time Rollup encounters a Svelte file, it hands it off to this plugin. The plugin then converts the component into browser-ready output. You can configure it to handle custom file extensions, filter which files get processed, and decide how CSS styles are handled, either by extracting them into separate files or injecting them directly into the page through JavaScript. This tool would be used by developers who already use Rollup as their bundler and want to incorporate Svelte components into their project. For example, if you maintain an existing web application built with Rollup and want to gradually introduce Svelte for individual UI pieces, this plugin makes that possible. It also includes a feature for importing third-party Svelte components from shared packages, ensuring your app uses the uncompiled source code, which produces a smaller, faster end product and reduces version conflicts. However, the README itself notes that most people starting new projects today should look elsewhere. The maintainers recommend using SvelteKit or Vite instead, which are more modern build setups that handle Svelte out of the box. This plugin remains relevant primarily for teams with existing Rollup-based workflows who aren't ready to switch, or for library authors publishing Svelte components to shared registries.

Copy-paste prompts

Prompt 1
I have an existing Rollup setup for my web app. Show me how to install and configure rollup-plugin-svelte so I can start using Svelte components.
Prompt 2
Help me configure rollup-plugin-svelte to import uncompiled Svelte components from a shared npm package instead of the pre-built version.
Prompt 3
Using rollup-plugin-svelte, how do I set it up so that CSS from my Svelte components is extracted into a separate file rather than injected into the page?
Prompt 4
I want to filter which Svelte files are processed by rollup-plugin-svelte based on a custom condition. How do I write that configuration?

Frequently asked questions

What is rollup-plugin-svelte?

A plugin that lets Rollup bundle Svelte components by compiling them into standard JavaScript and CSS. Mainly for existing Rollup projects, new projects should use Vite or SvelteKit instead.

What language is rollup-plugin-svelte written in?

Mainly JavaScript. The stack also includes JavaScript, Rollup, Svelte.

Is rollup-plugin-svelte actively maintained?

Maintained — commit in last 6 months (last push 2026-05-20).

What license does rollup-plugin-svelte use?

This project uses the MIT license, meaning you can use, modify, and distribute it freely for any purpose, including commercially, as long as you include the copyright notice.

How hard is rollup-plugin-svelte to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is rollup-plugin-svelte for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.