{"id":21948,"library":"rollup-plugin-circular-dependencies","title":"rollup-plugin-circular-dependencies","description":"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.","status":"active","version":"2.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/rushelex/rollup-plugin-circular-dependencies","tags":["javascript","rollup-plugin","rollup plugin","rollup","dependencies","circular-dependencies","circular dependencies","cyclic dependencies","typescript"],"install":[{"cmd":"npm install rollup-plugin-circular-dependencies","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-circular-dependencies","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-circular-dependencies","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin is designed for Rollup >=3.0.0","package":"rollup","optional":false}],"imports":[{"note":"ESM-only; CJS require() will not work because package type is module.","wrong":"const circularDependencies = require('rollup-plugin-circular-dependencies')","symbol":"circularDependencies","correct":"import { circularDependencies } from 'rollup-plugin-circular-dependencies'"},{"note":"DefaultFormatters is a named export, not a default export. Use object destructuring.","wrong":"","symbol":"DefaultFormatters","correct":"import { DefaultFormatters } from 'rollup-plugin-circular-dependencies'"},{"note":"Options is only a TypeScript type, not a runtime value. Use 'import type' to avoid runtime errors.","wrong":"import { Options } from 'rollup-plugin-circular-dependencies'","symbol":"type Options","correct":"import type { Options } from 'rollup-plugin-circular-dependencies'"}],"quickstart":{"code":"// rollup.config.js\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\nimport json from '@rollup/plugin-json';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'esm'\n  },\n  plugins: [\n    json(),\n    circularDependencies({\n      throwOnError: false,\n      formatOut: (data) => JSON.stringify(data, null, 2),\n      onDetected: (data) => {\n        console.log(`Detected ${data.cycles.length} cycles`);\n      }\n    })\n  ]\n};","lang":"javascript","description":"Rollup configuration using the plugin with options: warning mode, custom JSON formatter, and lifecycle hook."},"warnings":[{"fix":"Upgrade to Rollup >=3.0.0. If you must use Rollup v2, stay on v1.x.","message":"Dropped Rollup v2 support in v2.0.0","severity":"breaking","affected_versions":">=2.0.0 <2.0.0"},{"fix":"Upgrade to v1.2.0-rc.6 or later for native ESM/CJS support.","message":"ESM dependencies removed; the package now ships ESM and CJS natively starting from v1.2.0-rc.6","severity":"deprecated","affected_versions":"<1.2.0-rc.6"},{"fix":"Ensure your Node.js version is >=20.12.0. Use nvm to update.","message":"Node.js version requirement raised to >=20.12.0 in v1.2.0-rc.6","severity":"breaking","affected_versions":">=1.2.0-rc.6"},{"fix":"Set throwOnError: false in options to only emit warnings instead of errors.","message":"Plugin crashes on build if circular dependencies are found and throwOnError is true (default)","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure consistent file extensions or use Rollup's resolve plugin to normalize.","message":"Mutual imports with different file extensions (e.g., .js vs .ts) can cause false positives/negatives","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'2.0.1':23 '20.12.0':63 '2026':26 '3':59 '4':61 'algorithm':18 'built':31 'built-in':30 'circular':4,13,33,102,104 'circular-depend':101 'cjs':73 'configur':37 'consol':43 'current':19 'cycl':50,92 'cyclic':106 'depend':5,14,34,100,103,105,107 'detect':10,55 'differenti':74 'esm':71 'februari':25 'file':46 'filter':51 'format':76 'found':84 'hook':53,78 'includ':39 'javascript':93 'json':45 'lifecycl':52,77 'like':88 'log':44 'metric':56 'mode':81 'node.js':62 'output':38 'per':49 'per-cycl':48 'plugin':3,8,87,91,96,98 'pretti':41 'pretty-print':40 'print':42 'releas':24 'replac':27 'report':12,47 'rich':75 'rollup':2,28,58,90,95,97,99 'rollup-plugin':94 'rollup-plugin-circular-depend':1 'rollup-plugin-cycl':89 'rollup/vite':7 'ship':64 'similar':86 'stabl':20 'support':57,82 'tarjan':16 'type':66 'typescript':65,108 'use':15 'version':21 'warn':35 'watch':80 'work':68","created_at":"2026-04-27T17:02:35.829368+00:00","updated_at":"2026-04-27T17:02:35.829368+00:00","problems":[{"fix":"Run `npm install -D rollup-plugin-circular-dependencies` and ensure your rollup config uses the exact import: `import { circularDependencies } from 'rollup-plugin-circular-dependencies'`","cause":"Package not installed or import path typo","error":"Error: Cannot find module 'rollup-plugin-circular-dependencies'"},{"fix":"Use named import: `import { circularDependencies } from 'rollup-plugin-circular-dependencies'`","cause":"Default import used instead of named import in ESM context","error":"TypeError: circularDependencies is not a function"},{"fix":"Use `import type { Options } from 'rollup-plugin-circular-dependencies'` or omit the import if not needed","cause":"Options is a TypeScript type, not a runtime value; importing it with destructuring fails at runtime","error":"The requested module 'rollup-plugin-circular-dependencies' does not provide an export named 'Options'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/rushelex/rollup-plugin-circular-dependencies","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-plugin-circular-dependencies","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}