Skip to main content

Rolldown

Rolldown is the Rust-based, Rollup-API-compatible bundler that Vite uses internally. It's offered as a bundler peer to Rollup, tsup, and esbuild. The preset produces unbundled, per-file ESM + CJS output and leaves every dependency external so the published library stays thin — the same shape as the Rollup preset, but Rolldown transpiles TypeScript natively, so there's no @rollup/plugin-typescript to install.

Usage

Re-export the default config:

// rolldown.config.mjs
export { default } from '@rtorcato/repo-tooling/rolldown'

…or customize the entry point:

// rolldown.config.mjs
import { getConfig } from '@rtorcato/repo-tooling/rolldown'

export default getConfig({ input: 'src/main.ts' })

Then wire it into package.json:

{
"scripts": {
"build": "rolldown -c",
"build:watch": "rolldown -c --watch"
}
}

setup scaffolds this for you when you pick Rolldown, and npx @rtorcato/repo-tooling fix rolldown drops the rolldown.config.mjs into an existing project.

Peer dependency

Only rolldown is needed (added automatically by setup/fix) — TypeScript is transpiled natively.

Type declarations

Rolldown's .d.ts output is still experimental, so the preset doesn't emit declarations. Generate them with tsc alongside the bundle:

{
"scripts": {
"build": "rolldown -c && tsc --emitDeclarationOnly --outDir dist"
}
}

API

getConfig(options?)

Returns a Rolldown config with ESM + CJS outputs.

OptionDefaultMeaning
inputsrc/index.tsLibrary entry point
outDirdistOutput directory
sourcemaptrueEmit sourcemaps
externalevery bare importWhich ids to leave external