Interface: RolldownBuild
The bundle object returned by rolldown function.
Accessors
closed
Get Signature
- Type: () =>
boolean
Whether the bundle has been closed.
If the bundle is closed, calling other methods will throw an error.
Returns
boolean
Methods
close()
- Type: () =>
Promise<void>
Close the bundle and free resources.
This method should be called even if the generate method or the write method threw an error. It should be called even if neither of the methods are called.
This method is called automatically when using using syntax.
Returns
Promise<void>
Example
import { rolldown } from 'rolldown';
{
using bundle = await rolldown({ input: 'src/main.js' });
const output = await bundle.generate({ format: 'esm' });
console.log(output);
// bundle.close() is called automatically here
}generate()
- Type: (
outputOptions:OutputOptions) =>Promise<RolldownOutput>
Generate bundles in-memory.
If you directly want to write bundles to disk, use the write method instead.
Parameters
outputOptions?
OutputOptions = {}
The output options.
Returns
Promise<RolldownOutput>
The generated bundle.
Throws
BundleError When an error occurs during the build.
write()
- Type: (
outputOptions:OutputOptions) =>Promise<RolldownOutput>
Generate and write bundles to disk.
If you want to generate bundles in-memory, use the generate method instead.
Parameters
outputOptions?
OutputOptions = {}
The output options.
Returns
Promise<RolldownOutput>
The generated bundle.
Throws
BundleError When an error occurs during the build.
