rollup-plugin-svelte-types Svelte Themes

Rollup Plugin Svelte Types

A plugin for exporting type definitions for Svelte

rollup-plugin-svelte-types

šŸ£ A Rollup plugin which generates type definitions for Svelte Components, including Props and Events.

Requirements

This plugin requires an LTS Node version (v8.0.0+) and Rollup v1.20.0+.

Install

Using npm:

npm install rollup-plugin-svelte-types --save-dev

Usage

Create a rollup.config.js configuration file and import the plugin:

import svelteDts from 'rollup-plugin-svelte-types';

export default {
  input: 'src/entry.js',
  // ...
  plugins: [
    svelteDts()
  ]
};

Then call rollup either via the CLI or the API.

Options

It's possible to use configure a few settings:

import svelteDts from 'rollup-plugin-svelte-types';

export default {
  input: 'src/entry.js',
  // ...
  plugins: [
    svelteDts({
        libRoot: './src', // The root directory to generate the type definitions for. Defaults to './'
        declarationDir: './dist/types' // The directory to place the generated definitions in. Defaults to './types'
    })
  ]
};

License

MIT

Top categories

Loading Svelte Themes