unplugin-oxc
Version:
Oxc integration for unplugin.
178 lines (135 loc) β’ 3.6 kB
Markdown
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Unit Test][unit-test-src]][unit-test-href]
[](https://oxc.rs/) integration for unplugin.
- π **Blazing Fast**: Transform, resolve, and minify files with Oxc, built in Rust.
- π¦Ύ **Powerful**: Supports TypeScript and React JSX transformation, identifier replacement, syntax lowering, and more.
- π¦ **Zero Config**: No configuration needed for TypeScript support.
- π¨ **Customizable**: Fine-tune transform, resolve, and minify options.
- π **Drop-in Replacement**: Easily replace [rollup-plugin-esbuild](https://github.com/egoist/rollup-plugin-esbuild) and [@rollup/plugin-node-resolve](https://github.com/rollup/plugins/tree/master/packages/node-resolve).
```bash
npm i -D unplugin-oxc
```
<details>
<summary>Vite</summary><br>
```ts
// vite.config.ts
import Oxc from 'unplugin-oxc/vite'
export default defineConfig({
plugins: [Oxc()],
})
```
<br></details>
<details>
<summary>Rollup</summary><br>
```ts
// rollup.config.js
import Oxc from 'unplugin-oxc/rollup'
export default {
plugins: [Oxc()],
}
```
<br></details>
<details>
<summary>Rolldown</summary><br>
```ts
// rolldown.config.js
import Oxc from 'unplugin-oxc/rolldown'
export default {
plugins: [Oxc()],
}
```
<br></details>
<details>
<summary>esbuild</summary><br>
```ts
import { build } from 'esbuild'
import Oxc from 'unplugin-oxc/esbuild'
build({
plugins: [Oxc()],
})
```
<br></details>
<details>
<summary>Webpack</summary><br>
```js
// webpack.config.js
import Oxc from 'unplugin-oxc/webpack'
export default {
/* ... */
plugins: [Oxc()],
}
```
<br></details>
<details>
<summary>Rspack</summary><br>
```ts
// rspack.config.js
import Oxc from 'unplugin-oxc/rspack'
export default {
/* ... */
plugins: [Oxc()],
}
```
<br></details>
<details>
<summary>unloader</summary><br>
```ts
// unloader.config.ts
import Oxc from 'unplugin-oxc/unloader'
export default defineConfig({
plugins: [Oxc()],
})
```
<br></details>
## Usage
```ts
interface Options {
/**
* @default [/\.[cm]?[jt]sx?$/],
*/
include?: FilterPattern
/**
* @default [/node_modules/],
*/
exclude?: FilterPattern
enforce?: 'pre' | 'post' | undefined
/**
* Transform options passed to `oxc-transform`
*/
transform?: Omit<TransformOptions, 'sourcemap'> | false
/**
* Resolve options passed to `oxc-resolver`
*/
resolve?: NapiResolveOptions | false
/**
* The plugin will skip resolving node_modules by default.
* Set this to `true` to resolve node_modules.
* @default false
*/
resolveNodeModules?: boolean
/**
* Minify options passed to `oxc-minify`
*/
minify?: Omit<MinifyOptions, 'sourcemap'> | false
sourcemap?: boolean
}
```
<p align="center">
<a href="https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg">
<img src='https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg'/>
</a>
</p>
[](./LICENSE) License Β© 2025-PRESENT [δΈε²ζΊε](https://github.com/sxzz)
<!-- Badges -->
[]: https://img.shields.io/npm/v/unplugin-oxc.svg
[]: https://npmjs.com/package/unplugin-oxc
[]: https://img.shields.io/npm/dm/unplugin-oxc
[]: https://www.npmcharts.com/compare/unplugin-oxc?interval=30
[]: https://github.com/unplugin/unplugin-oxc/actions/workflows/unit-test.yml/badge.svg
[]: https://github.com/unplugin/unplugin-oxc/actions/workflows/unit-test.yml