rollup-timer
raw JSON → 0.3.4 verified Mon Apr 27 auth: no javascript maintenance
Times Rollup plugins by monkey-patching plugin API functions. Version 0.3.4 is stable with no recent updates; it works with Rollup <1 and is incompatible with rollup-plugin-commonjs. Differentiator: simple drop-in timing for Rollup builds, with support for both promise and stream-based rollup invocations.
Common errors
error TypeError: (0 , _rollupTimer2.default) is not a function ↓
cause Using named import 'time' instead of default import.
fix
Use 'import time from 'rollup-timer''
error time is not a function ↓
cause Incorrectly importing as named export or using CommonJS without .default.
fix
Use 'const time = require('rollup-timer').default'
Warnings
gotcha rollup-timer is incompatible with rollup-plugin-commonjs; timings for that plugin will be incomplete. ↓
fix Avoid using rollup-timer with rollup-plugin-commonjs, or expect inaccurate timing data.
deprecated The package monkey-patches internal Rollup API and may break with future Rollup versions. Last updated for Rollup 0.x; not tested with Rollup 1+. ↓
fix Consider using Rollup's built-in timing support or other profiling tools.
gotcha Plugin 'name' property required for readable reports; if a plugin lacks name, the report falls back to numeric index. ↓
fix Ensure plugins provide a 'name' property; submit PRs to plugin authors if missing.
Install
npm install rollup-timer yarn add rollup-timer pnpm add rollup-timer Imports
- time wrong
const time = require('rollup-timer')correctimport time from 'rollup-timer' - RollupTimer wrong
import RollupTimer from 'rollup-timer'correctimport { RollupTimer } from 'rollup-timer' - time (named import) wrong
import { time } from 'rollup-timer'correctimport * as timer from 'rollup-timer'; timer.default()
Quickstart
const rollup = require('rollup');
const time = require('rollup-timer').default;
time(rollup);
const options = { input: 'src/index.js', plugins: [] };
rollup.rollup(options).then(bundle => bundle.write({ file: 'dist/bundle.js' })).catch(err => console.error(err));