Skip to content

Function: rolldown() ​

The API compatible with Rollup's rollup function.

Unlike Rollup, the module graph is not built until the methods of the bundle object are called.

Parameters ​

input ​

InputOptions

The input options object.

Returns ​

Promise<RolldownBuild>

A Promise that resolves to a bundle object.

Example ​

js
import { rolldown } from 'rolldown';

let bundle, failed = false;
try {
  bundle = await rolldown({
    input: 'src/main.js',
  });
  await bundle.write({
    format: 'esm',
  });
} catch (e) {
  console.error(e);
  failed = true;
}
if (bundle) {
  await bundle.close();
}
process.exitCode = failed ? 1 : 0;

Was this page helpful?