npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vite-plugin-oxc

v0.0.2

Published

Oxc integration for Vite

Readme

vite-plugin-oxc

🚀 Blazing Fast Oxc integration for Vite - Transform, resolve, and minify your code with the power of Rust.

Features

  • 🚀 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
  • 🔧 Vite Focused: Designed specifically for Vite with optimal integration

Installation

npm i -D vite-plugin-oxc
# or
pnpm add -D vite-plugin-oxc
# or
yarn add -D vite-plugin-oxc

Requirements

  • Node.js: 20.19+ or 22.12+
  • Vite: 4.0+ (supports Vite 4, 5, 6, and 7)

Usage

Basic Setup

// vite.config.ts
import { defineConfig } from 'vite'
import oxc from 'vite-plugin-oxc'

export default defineConfig({
  plugins: [oxc()],
})

Advanced Configuration

// vite.config.ts
import { defineConfig } from 'vite'
import oxc from 'vite-plugin-oxc'

export default defineConfig({
  plugins: [
    oxc({
      // Files to include (default: /\.[cm]?[jt]sx?$/)
      include: [/\.[jt]sx?$/],

      // Files to exclude (default: /node_modules/)
      exclude: [/node_modules/, /\.spec\./],

      // Plugin enforcement (default: undefined)
      enforce: 'pre',

      // Transform options
      transform: {
        jsx: {
          runtime: 'automatic', // React 17+ automatic JSX runtime
          pragma: 'h', // Custom JSX pragma
        },
        typescript: {
          declaration: false,
        },
        // Enable syntax lowering
        target: 'es2020',
      },

      // Resolve options
      resolve: {
        extensions: ['.ts', '.tsx', '.js', '.jsx'],
        conditionNames: ['import', 'module', 'default'],
      },

      // Enable resolving node_modules (default: false)
      resolveNodeModules: false,

      // Minify options (default: false)
      minify: {
        compress: true,
        mangle: true,
      },

      // Source map generation (default: true in dev, false in prod)
      sourcemap: true,
    }),
  ],
  build: {
    target: 'es2020',
    minify: false, // Let oxc handle minification
  },
})

Options

include

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

Files to include for transformation.

exclude

  • Type: FilterPattern
  • Default: [/node_modules/]

Files to exclude from transformation.

enforce

  • Type: 'pre' | 'post' | undefined
  • Default: undefined

Plugin enforcement order.

transform

  • Type: TransformOptions | false
  • Default: {}

Transform options passed to oxc-transform. Set to false to disable transformation.

resolve

  • Type: NapiResolveOptions | false
  • Default: {}

Resolve options passed to oxc-resolver. Set to false to disable custom resolution.

resolveNodeModules

  • Type: boolean
  • Default: false

Whether to resolve node_modules. The plugin skips resolving node_modules by default for performance.

minify

  • Type: MinifyOptions | boolean
  • Default: false

Minify options passed to oxc-minify. Set to true for default minification or false to disable.

sourcemap

  • Type: boolean
  • Default: true in development, false in production

Enable source map generation.

Examples

Check out the examples directory for complete working examples:

Quick Start Examples

React with TypeScript

// vite.config.ts
import { defineConfig } from 'vite'
import vitePluginOxc from 'vite-plugin-oxc'

export default defineConfig({
  plugins: [
    vitePluginOxc({
      transform: {
        jsx: {
          runtime: 'automatic',
        },
      },
      minify: true,
    }),
  ],
  build: {
    minify: false, // Let oxc handle minification
  },
})

Custom JSX (Preact)

// vite.config.ts
import { defineConfig } from 'vite'
import vitePluginOxc from 'vite-plugin-oxc'

export default defineConfig({
  plugins: [
    vitePluginOxc({
      transform: {
        jsx: {
          runtime: 'classic',
          pragma: 'h',
          pragmaFrag: 'Fragment',
        },
      },
    }),
  ],
})

Production Optimization

// vite.config.ts
import { defineConfig } from 'vite'
import vitePluginOxc from 'vite-plugin-oxc'

export default defineConfig({
  plugins: [
    vitePluginOxc({
      transform: {
        target: 'es2020',
      },
      minify: {
        compress: {
          drop_console: true,
          drop_debugger: true,
        },
        mangle: true,
      },
      sourcemap: false,
    }),
  ],
  build: {
    minify: false, // Let oxc handle minification
  },
})

Running Examples

# Clone the repository
git clone <repository-url>
cd vite-plugin-oxc

# Build the plugin
npm install
npm run build

# Run simple TypeScript example
cd examples/simple
npm install
npm run dev

# Run React example
cd ../basic
npm install
npm run dev

Performance

This plugin leverages Oxc's Rust-based toolchain for maximum performance:

  • Transform: Up to 20x faster than TypeScript compiler
  • Resolve: Faster module resolution with caching
  • Minify: Competitive with the fastest JavaScript minifiers

Comparison with unplugin-oxc

This plugin is focused specifically on Vite, while unplugin-oxc supports multiple bundlers. Choose this plugin if:

  • You're only using Vite
  • You want optimal Vite integration
  • You prefer a focused, lightweight solution

Choose unplugin-oxc if:

  • You need support for multiple bundlers (Webpack, Rollup, etc.)
  • You want a universal solution

License

MIT