Registry / devops / unplugin-oxc-minifier

unplugin-oxc-minifier

JSON →
library1.1.0jsnpmunverified

Unofficial unplugin wrapping the oxc-minifier Rust-based JavaScript/TypeScript minifier. Provides a unified plugin interface for Vite, Webpack, Rollup, Rolldown, Rspack, and esbuild. Current stable version is 1.1.0, released in 2025. Key differentiators: ~10x faster than Terser in many benchmarks, zero-config TypeScript support, and flexible minification options (compress, mangle, codegen, sourcemap). Requires Node >=20.19.0 and ships TypeScript types.

npm install unplugin-oxc-minifier
INSTALL
IMPORT
SIG · UNPLUGIN-OXC-MINIF
U
unplugin-oxc-minifier
devopsjavascriptv1.1.0
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.

OxcMinifier (Vite)
import OxcMinifier from 'unplugin-oxc-minifier/vite'
import OxcMinifier from 'unplugin-oxc-minifier'
Default import from the package root does not exist. Must use a subpath for your bundler.
OxcMinifier (Rollup)
import OxcMinifier from 'unplugin-oxc-minifier/rollup'
const OxcMinifier = require('unplugin-oxc-minifier/rollup')
The package is ESM-only; require() will fail. Use dynamic import() if needed.
OxcMinifier (Webpack)
import OxcMinifier from 'unplugin-oxc-minifier/webpack'
import OxcMinifier from 'unplugin-webpack-oxc-minifier'
No separate webpack plugin; use unplugin subpath.
OxcMinifier (esbuild)
import OxcMinifier from 'unplugin-oxc-minifier/esbuild'
import { OxcMinifier } from 'unplugin-oxc-minifier'
Named export not available; use default import from subpath.
OxcMinifier options
import type { Options } from 'unplugin-oxc-minifier'
import { OxcMinifierOptions } from 'unplugin-oxc-minifier'
Options type is exported from root; check types for CompressOptions, MangleOptions etc. from oxc.

Configures Vite to use oxc-minifier with console dropping, mangling, and no sourcemaps.

import OxcMinifier from 'unplugin-oxc-minifier/vite' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ OxcMinifier({ compress: { drop_console: true, drop_debugger: true }, mangle: { toplevel: true }, sourcemap: false }) ] })
Debug
Known issues
breakingNode.js version must be >=20.19.0. Older versions cause runtime errors.
fix
Update Node.js to v20.19.0 or later.
affects: <1.0
gotchaImporting from the root package 'unplugin-oxc-minifier' without a subpath (e.g., '/vite') will fail — there is no default export.
fix
Use import from 'unplugin-oxc-minifier/[bundler]' where [bundler] is vite, rollup, webpack, etc.
affects: >=1.0
deprecatedUsing CommonJS require() to load the plugin will throw because the package is ESM-only.
fix
Convert your project to ESM or use dynamic import() in an async context.
affects: >=1.0
gotchaThe 'include' and 'exclude' options accept FilterPattern (RegExp, string, or function), but do not support glob patterns.
fix
Use RegExp or string paths; use picomatch/micromatch if you need globs.
affects: >=1.0
gotchaWhen migrating from TerserPlugin, the options structure differs: compress, mangle options are not nested under 'terserOptions'.
fix
Pass compress and mangle directly at top-level; refer to OxcMinifier options documentation.
affects: >=1.0
breakingThe 'module' option enables ES module-specific minification (e.g., tree-shaking), but may break CommonJS or UMD builds if enabled incorrectly.
fix
Only set 'module: true' if your output is ES module format.
affects: >=1.0
Errors
Common errors & fixes
Error: The 'unplugin-oxc-minifier' plugin doesn't have a default export. Did you mean to import from 'unplugin-oxc-minifier/vite'?
Importing from the package root without a subpath.
fix
Change import to 'unplugin-oxc-minifier/vite' (or /rollup, /webpack, /esbuild, /rolldown, /rspack).
TypeError: OxcMinifier is not a function
Using CommonJS require() on an ESM-only package.
fix
Switch to ES module imports or use dynamic import(): const OxcMinifier = (await import('unplugin-oxc-minifier/vite')).default
Error: Cannot find module 'unplugin-oxc-minifier/webpack'
Typo or missing bundler subpath.
fix
Ensure you are using one of: '/vite', '/rollup', '/webpack', '/esbuild', '/rolldown', '/rspack'. Case-sensitive.
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/unplugin-oxc-minifier/dist/index.mjs not supported.
Using require() in a CommonJS file.
fix
Convert your config file to ESM (e.g., rename .config.js to .config.mjs) or use dynamic import().
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
@oxc-project/typesoptionalProvides TypeScript types for Oxc minifier options (CompressOptions, MangleOptions, CodegenOptions)
Agent activity
6 hits · last 30 days
node
6
Resources
unplugin-oxc-minifier — npm install unplugin-oxc-minifier · libregistry