Skip to content

Rollup plugin used to transpile JavaScript/TypeScript code with oxc

License

Notifications You must be signed in to change notification settings

marcalexiei/rollup-plugin-oxc-transform

Repository files navigation

rollup-plugin-oxc-transform

CI Code style: prettier npm version issues

🍣 A Rollup plugin to transpile TypeScript/JavaScript with oxc-transformer.

Warning

Work in progress

Tip

If you need to generate declarations consider to use unplugin-isolated-decl

Install

npm i --save-dev rollup oxc-transform oxc-resolve rollup-plugin-oxc-transform
yarn add --dev rollup oxc-transform oxc-resolve rollup-plugin-oxc-transform
pnpm add --save-dev rollup oxc-transform oxc-resolve rollup-plugin-oxc-transform

Usage

// rollup.config.js
import { defineConfig } from 'rollup';
import { oxcTransform } from 'rollup-plugin-oxc-transform';

export default defineConfig({
  input: 'src/index.js',
  output: {
    dir: 'dist',
    format: 'esm',
  },
  plugins: [
    oxcTransform(/* options */),

    // other plugins...
  ],
});

Options

Tip

Typescript declaration files are included in the plugin release, so you can rely on autocomplete features when providing plugin configuration

include

  • Type: FilterPattern
  • Default: /\.[mc]?[jt]sx?$/

Which files are processed by the plugin

exclude

  • Type: FilterPattern
  • Default: /node_modules/

Which files are excluded from plugin processing

resolveOptions

  • Type: ResolveOptions
  • Default: undefined

Options passed to oxc-resolver. By default the plugin will provide the following options:

  • conditionNames ['node', 'import']
  • extensions ['.ts', '.tsx', '.mjs', '.js', '.cjs', '.jsx']

Note

They can be both customized by passing your own property via resolveOptions

transformOptions

  • Type: Omit<TransformOptions, 'typescript'>;
  • Default: undefined

All options accept by oxc-transform excluding typescript property.

Warning

If you need to generate declarations consider to use unplugin-isolated-decl

Meta

CONTRIBUTING

LICENSE (MIT)

Thanks

This plugin is based on @rollup/plugin-swc