Plugin API
🚧 Under Construction
We are working on creating a more detailed reference. For now, please refer to Rollup's Plugin API.
Rolldown's plugin interface is almost fully compatible with Rollup's (detailed tracking here), so if you have written a Rollup plugin before, you already know how to write a Rolldown plugin!
We are still working on creating a more detailed guide for users who are new to both Rollup and Rolldown. For now, please first refer to Rollup's plugin development guide.
Notable Differences from Rollup
While Rolldown's plugin interface is largely compatible with Rollup's, there are some important behavioral differences to be aware of:
Output Generation Handling
In Rollup, all outputs are generated together in a single process. However, Rolldown handles each output generation separately. This means that if you have multiple output configurations, Rolldown will process each output independently, which can affect how certain plugins behave, especially those that maintain state across the entire build process.
These are the concrete differences:
outputOptionshook is called before the build hooks in Rolldown, whereas Rollup calls them after the build hooks- Build hooks are called for each output separately, whereas Rollup calls them once for all outputs
closeBundlehook is called only when you calledgenerate()orwrite()at least once, whereas Rollup calls it regardless of whether you calledgenerate()orwrite()
Sequential Hook Execution
In Rollup, certain hooks like writeBundle are "parallel" by default, meaning they run concurrently across multiple plugins. This requires plugins to explicitly set sequential: true if they need their hooks to run one after another.
In Rolldown, the writeBundle hook is already sequential by default, so plugins do not need to specify sequential: true for this hook.
Builtin Plugins
Rolldown offers a set of built-in plugins, implemented in Rust, to achieve higher performance.