A Rollup/Vite plugin for detecting and reporting circular dependencies using Tarjan's algorithm. Current stable version is 2.0.1, released February 2026. Replaces Rollup's built-in circular dependency warnings with configurable output, including pretty-printed console logs, JSON file reports, per-cycle filtering, lifecycle hooks, and detection metrics. Supports Rollup 3 and 4, Node.js >=20.12.0, ships TypeScript types, and works with both ESM and CJS. Differentiator: rich formatting, lifecycle hooks, and watch mode support not found in similar plugins like rollup-plugin-cycle.
npm install rollup-plugin-circular-dependenciesVerified import paths — ran on the pinned version, not inferred.
Rollup configuration using the plugin with options: warning mode, custom JSON formatter, and lifecycle hook.
Upgrade to Rollup >=3.0.0. If you must use Rollup v2, stay on v1.x.
Upgrade to v1.2.0-rc.6 or later for native ESM/CJS support.
Ensure your Node.js version is >=20.12.0. Use nvm to update.
Set throwOnError: false in options to only emit warnings instead of errors.
Ensure consistent file extensions or use Rollup's resolve plugin to normalize.
Run `npm install -D rollup-plugin-circular-dependencies` and ensure your rollup config uses the exact import: `import { circularDependencies } from 'rollup-plugin-circular-dependencies'`Use named import: `import { circularDependencies } from 'rollup-plugin-circular-dependencies'`Use `import type { Options } from 'rollup-plugin-circular-dependencies'` or omit the import if not needed