Registry / devops / vite-plugin-oxc

vite-plugin-oxc

JSON →
library0.0.4jsnpmunverified

Vite plugin that uses the Oxc (Rust-based) toolchain to transform, resolve, and minify JavaScript/TypeScript/JSX files. Version 0.0.4 (pre-release, rare releases). Key differentiator: extremely fast Rust-backed transforms vs Babel-based plugins. However, it is now deprecated; upstream development merged into @vitejs/plugin-react for rolldown-vite. Supports Vite 4-7. Ships TypeScript types.

npm install vite-plugin-oxc
INSTALL
IMPORT
SIG · VITE-PLUGIN-OXC
V
vite-plugin-oxc
devopsjavascriptv0.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import oxc from 'vite-plugin-oxc'
const oxc = require('vite-plugin-oxc')
ESM-only; CommonJS require will fail. Use dynamic import if needed.
oxc (plugin)
import oxc from 'vite-plugin-oxc'; export default defineConfig({ plugins: [oxc()] })
export default { plugins: [require('vite-plugin-oxc').default()] }
Import default, then call as a function to create plugin instance.
vite.config.ts (type)
import type { UserConfig } from 'vite'
import type { VitePluginOxcOptions } from 'vite-plugin-oxc'
Options type is not exported; use inline object or infer from UserConfig.

Basic Vite config with Oxc plugin enabling JSX transform and minification (disable Vite's built-in minifier).

// vite.config.ts import { defineConfig } from 'vite' import oxc from 'vite-plugin-oxc' export default defineConfig({ plugins: [ oxc({ transform: { jsx: { runtime: 'automatic' }, target: 'es2020' }, minify: { compress: true, mangle: true }, sourcemap: true }) ], build: { target: 'es2020', minify: false } })
Debug
Known issues
deprecatedThis package is deprecated. Use @vitejs/plugin-react instead.
fix
Replace with `@vitejs/plugin-react` and configure for rolldown-vite as per the README.
affects: >=0.0.1
gotchaThe plugin is ESM-only; using require('vite-plugin-oxc') will throw an error.
fix
Use dynamic import: const oxc = await import('vite-plugin-oxc') in CommonJS context.
affects: >=0.0.1
gotchaSource maps are enabled by default in dev but disabled in production (build).
fix
Set `sourcemap: true` explicitly to enable in production builds.
affects: >=0.0.1
gotchaSetting `minify: true` in plugin and also enabling Vite's minify (build.minify) may cause double minification.
fix
Disable Vite's minification (`build.minify: false`) when using oxc minify.
affects: >=0.0.1
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/vite-plugin-oxc/dist/index.mjs not supported.
Using CommonJS require() on an ESM-only package.
fix
Use dynamic import: `const oxc = await import('vite-plugin-oxc')` or switch to ESM (type: module in package.json).
TypeError: oxc is not a function
Importing the plugin incorrectly (e.g., as default from a CJS fallback).
fix
Use `import oxc from 'vite-plugin-oxc'` then call `oxc()` to get the plugin object.
Error: Cannot find module 'vite-plugin-oxc'
Package not installed or wrong Node.js version (requires 20.19+ or 22.12+).
fix
Install with `npm i -D vite-plugin-oxc` and ensure Node.js >=20.19 || >=22.12.
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies
viterequiredPeer dependency: Vite v4, v5, v6, or v7 required to use the plugin.
oxc-transformrequiredN-API dependency for Oxc transformations (bundled).
Agent activity
10 hits · last 30 days
node
10
Resources
vite-plugin-oxc — npm install vite-plugin-oxc · libregistry