Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

mentaljam/rollup-plugin-swc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rollup-plugin-swc

Rollup plugin to compile bundles with the SWC.

Install

npm i -D rollup-plugin-swc @swc/core

Note: @swc/core is a peer dependency

Usage

// rollup.config.js

import swc from 'rollup-plugin-swc'


export default {
  input: 'index.ts',
  output: {
    dir: 'dist',
    format: 'es',
  },
  plugins: [
    swc({
      rollup: {
        exclude: 'path/to/exclude/',
      },
      jsc: {
        parser: {
          syntax: 'typescript',
        },
        target: 'es2018',
      },
    }),
  ],
}

Options

The plugin takes all the SWC options except the filename.

In addition to the above SWC Options, it takes following options for smoother integration with the rollup plugin convention:

rollup.exclude

Type: String | Array[...String]
Default: null

A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore. By default no files are ignored.

rollup.include

Type: String | Array[...String]
Default: null

A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should operate on. By default all files are targeted.

License

MIT © Petr Tsymbarovich