OXC
Next-generation JavaScript toolchain
OXC Transformer
The OXC transformer is built on the next-generation, Rust-based oxc toolchain. It aims to be one of the fastest JavaScript/TypeScript transformers available.
OXC is experimental and under active development. Some features may be unstable or change between releases — use with caution in production environments.
Overview
This example shows how to select the OXC transformer. OXC compilation is driven almost entirely by your tsconfig.json and the build runtime — Packem derives the TypeScript and JSX settings for you, so there is very little to configure by hand.
OXC handles:
- TypeScript transformation (type stripping, down-leveling to a resolved target)
- JSX (classic and automatic runtimes)
- Source maps
When to Use
- Experimental projects willing to adopt bleeding-edge tooling
- Performance research and benchmarking
- Contributing to or evaluating the next generation of JavaScript tooling
For production libraries, prefer esbuild or swc, which are stable and feature-complete.
Project Setup
TypeScript Configuration
OXC reads JSX and target settings from your tsconfig. A typical setup:
{
"compilerOptions": {
"target": "ES2020",
"jsx": "react-jsx",
"jsxImportSource": "react"
}
}Packem Configuration
Selecting the transformer is all that most projects need — the JSX runtime, pragma, and TypeScript options are resolved from your tsconfig automatically:
import { defineConfig } from '@visulima/packem/config'
import transformer from '@visulima/packem/transformer/oxc'
export default defineConfig({
transformer
})Unlike esbuild, swc, and sucrase, OXC's transform options are managed internally by Packem (target resolution, JSX runtime, TypeScript flags, and source maps are all set from your tsconfig and top-level options). There is no large user-facing rollup.oxc block to tune for typical builds.
Building
packem buildNotes
- OXC's
targetis resolved from your tsconfigcompilerOptions.targetplus the build runtime, the same way esbuild's target is resolved. - JSX
refresh(React Fast Refresh) is disabled — it is not needed for a library build. - Declaration files are generated by Packem's dedicated declaration plugin, not by OXC.
- Because OXC is experimental, validate your output carefully and consider falling back to esbuild or swc if you hit transformation issues.