OXC Toolchain

Why Manic replaces Babel, Terser, ESLint, and Prettier with the Rust-powered OXC toolchain.

OXC Toolchain

Manic's build engine is built on top of the OXC (Oxidation Compiler) toolchain, a suite of Rust-based JavaScript tools authored for raw speed. Adopting OXC end-to-end means there is no AST round-tripping between unrelated tools — every step of the pipeline shares the same parser and AST representation.

ToolReplacesUsed By
oxc-transformBabel, SWCDev server, manic build (transform stage)
oxc-minifyTerser, esbuildmanic build (minify stage)
oxc-resolverenhanced-resolvePlugin lookup, custom imports
oxlintESLintmanic lint, mandatory build guard
OXC formatterPrettiermanic fmt

All of these are bundled with manicjs, so projects do not need to install them separately.


oxc-transform — JSX & TypeScript

oxc-transform is the workhorse of the dev server. Manic registers it as a Bun plugin so every .ts, .tsx, .js, and .jsx file is transformed on demand.

What it provides:

  • JSX compilationreact-jsx runtime by default, no React imports required.
  • TypeScript stripping — type annotations are removed without performing type-checking, the same trade-off Bun makes natively.
  • Import rewriting — extension hints like ./utils.ts are rewritten to ./utils.js for output compatibility (oxc.rewriteImportExtensions: true).
  • React Fast Refresh — when oxc.refresh: true (default in dev), components are wrapped with the Fast Refresh runtime so HMR preserves state.
manic.config.ts
import { defineConfig } from 'manicjs/config';

export default defineConfig({
  oxc: {
    target: 'esnext',              // 'es2022' is used by default in production
    rewriteImportExtensions: true,
    refresh: true,                 // React Fast Refresh
  },
});

oxc-minify — Production Compression

Minification is the most CPU-heavy stage of any production build. Manic runs oxc-minify against dist/client/, dist/api/, and the server bundle in parallel using Bun's worker model.

Capabilities:

  • Symbol mangling — local identifiers shrunk for byte savings.
  • Dead code elimination — unreachable branches removed.
  • Constant folding — pure expressions reduced at compile time.
  • Property mangling — opt-in for advanced setups.

You can disable minification for debugging by setting build.minify: false in your config.


oxc-resolver — Module Resolution

oxc-resolver is used inside the framework to look up plugin scripts, providers, and any module that the build engine needs to import outside of the Bun.build graph (e.g. preload scripts during manic dev).

It mirrors the resolution algorithm Node.js uses and respects package.json exports and imports maps.


oxlint — Mandatory Build Guard

oxlint is invoked in two places:

  1. Manuallymanic lint runs it across the whole repository.
  2. Automaticallymanic build runs it before any bundling. If the linter reports critical errors, the build aborts.
bunx manic lint

Configure rules in .oxlintrc.json:

.oxlintrc.json
{
  "rules": {
    "no-console": "off",
    "react/jsx-key": "error"
  }
}

oxlint ships with sensible React, TypeScript, and import rules out of the box, so most projects never need to author a config.


OXC Formatter — manic fmt

manic fmt invokes bun x oxfmt -c .oxfmt.json . — it does not forward extra argv. For --check / CI dry-runs, call oxfmt directly (Lint & format CLI).

manic fmt           # format workspace via manic wrapper
bun x oxfmt -c .oxfmt.json --check .   # CI-style check (manual)

A .oxfmt.json file at the project root tunes formatter options (line width, indentation, semicolons, etc.).


Why a Single Toolchain?

Initializing diagram...

Because every box in the pipeline above understands the same AST, Manic avoids:

  • Repeated parsing — the parser runs once per file, not once per tool.
  • Inconsistent semantics — the same JSX or TS edge case behaves identically across stages.
  • Slow IPC — there is no node-to-rust shell-out per file.

The practical result is build times measured in hundreds of milliseconds for typical applications and sub-second cold starts for serverless deploys.


See Also

On this page