PackemExamplesTransformersOXC

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 build

Notes

  • OXC's target is resolved from your tsconfig compilerOptions.target plus 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.
Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues