Executes some code when the bundle you are building is finished.
Using npm:
npm install --save-dev @rollup-extras/plugin-exec
import exec from "@rollup-extras/plugin-exec";
export default {
input: "src/index.js",
output: {
format: "es",
dir: "dest",
},
plugins: [
exec(() => {
console.log("finished");
}),
],
};Just pass options to the plugin function. The returned object is the plugin instance which can be passed to rollup.
exec({ option: value, option2: value2 });For additional plugin instances (in case of multiple configs) please use firstInstance.api.addInstance()
Optional, string.
For debugging purposes, so many instances of the plugin can be differentiated in debugging output.
Optional, (this: Context) => void
Main callback function to execute when the bundle is finished.
type CallbackFunction = (this: PluginContext & { logger: Logger }) => void;
export type ExecPluginOptions =
| {
pluginName?: string;
exec?: CallbackFunction;
}
| CallbackFunction;