@rolldown/plugin-babel

Official Babel transform plugin for Rolldown and Vite, with per-file preset filtering.

Library
npm
v0.2.4
19 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
65 /100 Good
Development Activity 92
Maintenance 100
Community 20
Maturity 28
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
80 /100 Excellent
Architecture 80
Code Quality 90
Innovation 78
Learning Curve 70

@rolldown/plugin-babel is the official Babel integration for Rolldown, the Rust-based bundler that powers Vite’s next-generation build pipeline. It runs Babel’s transform pass over .js, .jsx, .ts, and .tsx files, automatically wiring up the correct parser plugins so consumers don’t need to hand-configure Babel’s parser options for each file type.

Beyond a drop-in Babel-in-Rolldown bridge, the plugin adds a RolldownBabelPreset abstraction that lets a single Babel preset apply conditionally to a subset of files (by path, Rolldown module type, or file content) instead of running against every module. Those per-preset filters are compiled once and unioned into Rolldown’s native transform-hook filter, so files that no preset would touch never even reach the JavaScript transform callback. It also understands Vite’s multi-environment builds, supports both Babel 7 and Babel 8 through a type-safe compatibility layer, and can automatically wire in @babel/plugin-transform-runtime to deduplicate Babel’s helper functions across a project.

What You Get

  • A Rolldown/Vite plugin that runs Babel transforms with automatic JSX/TS/TSX parser configuration
  • Dual Babel 7 and Babel 8 compatibility via a type-safe compat layer, with no consumer-side branching required
  • Per-preset conditional application via defineRolldownBabelPreset, filtering by file path, Rolldown module type, or file content
  • Optional automatic @babel/plugin-transform-runtime wiring for deduplicated Babel helper output
  • Vite-aware per-environment (applyToEnvironmentHook) and resolved-config-aware (configResolvedHook) preset gating

Common Use Cases

  • Adding a Babel plugin or preset (e.g. decorators, throw-expressions) to a Rolldown or Vite build that Rolldown doesn’t transform natively
  • Applying different Babel presets to different file types or Vite environments (client vs SSR) in the same build
  • Migrating an existing rollup-plugin-babel configuration to Rolldown
  • Deduplicating Babel helper code across a large codebase via the runtimeVersion option

Under The Hood

Architecture

The plugin implements the Rolldown/Vite plugin lifecycle (config, configResolved, applyToEnvironment, outputOptions, transform) in index.ts, delegating option merging to options.ts (resolveOptions, createBabelOptionsConverter), transform-hook filter computation to filter.ts (calculateTransformFilter, which unions and intersects HookFilter dimensions — id, moduleType, code — across every registered RolldownBabelPreset), and Babel 7/8 type compatibility to babelCompat.ts. An envState map keyed by Vite environment name lets multi-environment builds carry distinct, pre-compiled Babel option converters computed once at configResolved/applyToEnvironment time and reused on every subsequent transform call, keeping the per-file hot path free of repeated filter recompilation.

Tech Stack

Written in TypeScript and published as ESM-only (type: module, single dist/index.mjs entry), built with tsdown and tested with Vitest as part of the rolldown/plugins pnpm monorepo, which shares Rolldown and Vite dev-dependency versions across packages via a pnpm catalog. The only runtime dependency is picomatch for glob-style path matching; @babel/core, @babel/plugin-transform-runtime, @babel/runtime, rolldown, and vite are all peer dependencies, with the Babel runtime helpers and Vite itself marked optional so the plugin stays usable in pure-Rolldown builds without Vite.

Code Quality

The package carries an extensive test suite relative to its size — over 1,700 lines across filter.test.ts, index.test.ts, and rolldownPreset.test.ts — exercising real Rolldown and Vite builds rather than mocking the bundler, including override merging, multi-dimension preset filtering, per-environment behavior, and Babel error propagation. The monorepo enforces oxlint --type-aware --type-check and oxfmt formatting repo-wide, plus CI workflows for linting, GitHub Actions security scanning (zizmor), and automated releases. Babel’s incompatible v7/v8 types are handled explicitly through conditional types rather than any-casting past the problem.

What Makes It Unique

The standout design choice is RolldownBabelPreset: instead of a preset applying unconditionally to every file, it carries its own filter (by path, Rolldown module type, or matched code) that the plugin compiles once and unions across all registered presets into Rolldown’s native transform-hook filter — meaning files no preset would touch skip the JS transform callback entirely, a genuine performance win specific to Rolldown’s filter-hook API rather than something bolted on afterward. Layered on top of that is Vite-specific environment and resolved-config gating for presets, and a from-scratch Babel 7/8 compatibility shim built on TypeScript conditional types so the same plugin code works against either major version’s API and type surface.

Used by 17 apps in this directory

Go
53%
MIT

memos

Note Taking

64,031

Open-source, self-hosted note-taking built for quick capture — Markdown-native, lightweight, and fully yours.

View details
91
Repo Health
78
Technical
65
Dependency
Built with
Go 53%
TypeScript 46%
Updated yesterday
TypeScript
88%
MIT

Mistle

AI Agents · Developer Tools

95

Self-hostable platform for running autonomous coding agents in isolated, credentialless sandboxes with brokered credentials, reusable snapshots, and event-driven triggers.

View details
50
Repo Health
76
Technical
70
Dependency
Built with
TypeScript 88%
Rust 11%
Updated 3 weeks ago
TypeScript
97%
GPL 3.0

OpenKnowledge

Code Editors · Knowledge Management · Note Taking

4,674

A beautiful, local-first markdown IDE that turns any git repo into a live collaborative workspace for humans and AI coding agents like Claude, Codex, and OpenCode.

View details
80
Repo Health
89
Technical
64
Dependency
Built with
TypeScript 97%
Updated yesterday
Python
49%
Other

Arize Phoenix

Analytics · Devops · Monitoring

11,976

Open-source AI observability platform for tracing, evaluating, and debugging LLM applications with built-in intelligence and MCP support.

View details
92
Repo Health
88
Technical
67
Dependency
Built with
Python 49%
TypeScript 43%
Updated yesterday
Go
68%
MIT

Probo

Automation · Security

1,476

Open-source GRC platform for engineering and security teams.

View details
87
Repo Health
90
Technical
69
Dependency
Built with
Go 68%
TypeScript 30%
Updated 2 days ago
TypeScript
96%
Apache 2.0

rakazo

AI Agents · AI Assistants

5,488

An open-source platform for persistent AI teammates that own their own conversations, memory, routines, and computers — self-hosted, model-agnostic, and available on web, desktop, and mobile.

View details
82
Repo Health
91
Technical
70
Dependency
Built with
TypeScript 96%
Updated 2 days ago
TypeScript
99%
MIT

Sanity

CMS

6,370

Open-source headless CMS with a fully customizable React Studio, real-time collaborative editing, structured content modeling, and GROQ query language

View details
92
Repo Health
90
Technical
66
Dependency
Built with
TypeScript 99%
Updated yesterday
TypeScript
97%
Apache 2.0

Unleash

Ab Testing Experimentation · Developer Tools · Devops

13,899

The open-source feature management platform that lets you ship code to production and control who sees it — without redeploying.

View details
91
Repo Health
84
Technical
69
Dependency
Built with
TypeScript 97%
Updated 2 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers