Function: rolldown()
rolldown(
input):Promise<RolldownBuild>
Defined in: api/rolldown/index.ts:39
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
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;