videojs-generate-rollup-config

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

Generates a standard Rollup configuration for Video.js plugins, reducing boilerplate across repositories. Current version 7.0.2 requires Rollup ^2.26.11 and provides preconfigured builds for CJS, ES, test, browser, and minified browser outputs. It supports customization via options like input, globals, externals, and plugins, and uses environment variables like TEST_BUNDLE_ONLY. Compared to writing manual Rollup configs, it enforces Video.js conventions and simplifies maintenance.

error Error: Cannot find module 'rollup'
cause Rollup not installed as a devDependency.
fix
npm install --save-dev rollup@^2.26.11
error Uncaught TypeError: generateRollupConfig is not a function
cause Attempting to import as ES module (import) instead of require.
fix
Use const generateRollupConfig = require('videojs-generate-rollup-config');
error TypeError: config.builds is not iterable
cause config.builds is an object, not an array.
fix
Wrap with Object.values(config.builds) before exporting.
deprecated Version 3+ supports Rollup ^1.0.0; version 7 requires Rollup ^2.26.11. Upgrade Rollup accordingly.
fix Update peer dependency to rollup@^2.26.11 for v7.
gotcha The package uses CommonJS and cannot be imported via ESM (import). Use require().
fix Use const x = require('videojs-generate-rollup-config') instead of import.
gotcha config.builds is an object, not an array. Must use Object.values() for Rollup's array input.
fix Use Object.values(config.builds) when exporting.
deprecated The environment variable greenkeeper badge in README references deprecated Greenkeeper service.
fix Ignore badge; service is no longer active.
gotcha Setting both TEST_BUNDLE_ONLY and NO_TEST_BUNDLE: TEST_BUNDLE_ONLY takes precedence.
fix Use only one environment variable to avoid confusion.
npm install videojs-generate-rollup-config
yarn add videojs-generate-rollup-config
pnpm add videojs-generate-rollup-config

Creates a Rollup config with standard Video.js plugin builds using CommonJS require.

const generate = require('videojs-generate-rollup-config');
const config = generate({
  input: 'src/plugin.js',
  distName: 'my-plugin',
  exportName: 'MyPlugin'
});
module.exports = Object.values(config.builds);