{"id":22159,"library":"rollup-plugin-peer-deps-external","title":"rollup-plugin-peer-deps-external","description":"Automatically externalizes peerDependencies in Rollup bundles. Current stable version is 2.2.4 (last released October 2020), with a maintenance status. It eliminates manual enumeration of peer dependencies in the `external` config, supports module paths (e.g., `lodash/map`), and includes an optional `includeDependencies` flag. Compared to manually listing externals or using pattern-based approaches, this plugin provides a zero-config solution that reads from package.json. It is widely used in library bundling workflows and has minimal dependencies (only `rollup` as a peer dependency). Release cadence is low; no new features since 2.2.0.","status":"maintenance","version":"2.2.4","language":"javascript","source_language":"en","source_url":"https://github.com/pmowrer/rollup-plugin-peer-deps-external","tags":["javascript","rollup","plugin","rollup-plugin","peerDependencies","external","optimize","exclude"],"install":[{"cmd":"npm install rollup-plugin-peer-deps-external","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-peer-deps-external","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-peer-deps-external","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin requires Rollup to function as a plugin.","package":"rollup","optional":false}],"imports":[{"note":"Default export via ESM. CJS require works (package exports both) but ESM is preferred in modern bundles.","wrong":"const peerDepsExternal = require('rollup-plugin-peer-deps-external')","symbol":"peerDepsExternal","correct":"import peerDepsExternal from 'rollup-plugin-peer-deps-external'"}],"quickstart":{"code":"// rollup.config.js\nimport peerDepsExternal from 'rollup-plugin-peer-deps-external';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'esm'\n  },\n  plugins: [\n    // Should be placed first to ensure peer deps are external before other plugins process them\n    peerDepsExternal()\n  ]\n};","lang":"javascript","description":"Basic Rollup configuration using the plugin to automatically externalize peer dependencies from package.json."},"warnings":[{"fix":"Avoid using `includeDependencies`; manually externalize dependencies if needed.","message":"The `includeDependencies` option is deprecated and may be removed in future.","severity":"deprecated","affected_versions":">=2.2.0 <3.0.0"},{"fix":"If you relied on only top-level packages being externalized, update your imports or use a custom external function.","message":"v2.0.0 changed behavior to also externalize module paths (e.g., 'lodash/map') in addition to top-level packages.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Place `peerDepsExternal()` as the first plugin in the `plugins` array.","message":"Plugin must run early in plugin list to externalize peer deps before other plugins (e.g., commonjs) resolve them.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Either use the plugin alone or manually merge external patterns by reading peerDependencies yourself.","message":"Does not handle custom `external` config; if you set both, the plugin may override or conflict.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install --save-dev rollup-plugin-peer-deps-external","cause":"Package not installed or missing from dependencies.","error":"Error: Cannot find module 'rollup-plugin-peer-deps-external'"},{"fix":"Use `import peerDepsExternal from 'rollup-plugin-peer-deps-external'` (default import).","cause":"Importing incorrectly (e.g., named import instead of default import).","error":"TypeError: peerDepsExternal is not a function"},{"fix":"Remove `includeDependencies` from plugin options.","cause":"Using deprecated `includeDependencies` option.","error":"(!) Plugin peerDepsExternal: Options includeDependencies is deprecated"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}