rollup-plugin-execute

raw JSON →
1.1.1 verified Mon Apr 27 auth: no javascript

A Rollup plugin that executes shell commands sequentially after the bundle is generated. Version 1.1.1 is stable with no recent releases; it accepts a command string or array of commands and runs them in order using child_process.execSync. Lightweight and zero-dependency, ideal for post-build tasks like copying files or opening a browser. Alternative to rollup-plugin-shell, but simpler with no cross-platform handling.

error Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
cause rollup-plugin-execute is ESM-only and cannot be required with CommonJS.
fix
Use import statement or set type: 'module' in package.json.
gotcha execute() runs synchronously using execSync, blocking the build until commands finish.
fix Keep commands quick to avoid slowing down the build; consider async alternatives for long tasks.
npm install rollup-plugin-execute
yarn add rollup-plugin-execute
pnpm add rollup-plugin-execute

Minimal Rollup config that writes a status file after bundle generation using execute().

// rollup.config.js
import execute from 'rollup-plugin-execute'

export default {
  input: 'src/index.js',
  output: { file: 'dist/bundle.js', format: 'esm' },
  plugins: [
    execute('echo "Build complete" > dist/status.txt')
  ]
}