{"id":21919,"library":"rollup-plugin-auto-external","title":"rollup-plugin-auto-external","description":"A Rollup plugin that automatically externalizes dependencies and peerDependencies listed in package.json, keeping them out of the bundle for library development. Version 2.0.0 (latest) supports Rollup ≥0.45.2 and Node ≥6. Key differentiator: automatically parses dependencies, peerDependencies, and optionalDependencies from package.json, unlike manual external configuration or other plugins that require explicit lists. Simple to set up with zero configuration for most cases.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/stevenbenisek/rollup-plugin-auto-external","tags":["javascript","rollup","plugin","external","auto","dependencies","peerDependencies"],"install":[{"cmd":"npm install rollup-plugin-auto-external","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-auto-external","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-auto-external","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - plugin requires Rollup to function","package":"rollup","optional":false}],"imports":[{"note":"ESM default export. CommonJS require works but is not idiomatic for Rollup plugins; prefer ESM import.","wrong":"const autoExternal = require('rollup-plugin-auto-external')","symbol":"default","correct":"import autoExternal from 'rollup-plugin-auto-external'"},{"note":"Named import is not available; the module only provides a default export. Always use default import.","symbol":"autoExternal","correct":"import autoExternal from 'rollup-plugin-auto-external'"},{"note":"The plugin is a function that returns a plugin object. Do not use 'new'.","wrong":"new autoExternal()","symbol":"autoExternal()","correct":"autoExternal()"}],"quickstart":{"code":"import autoExternal from 'rollup-plugin-auto-external';\n\nexport default {\n  input: 'src/index.js',\n  output: { file: 'dist/bundle.js', format: 'cjs' },\n  plugins: [\n    autoExternal()\n  ]\n};","lang":"javascript","description":"Shows minimal Rollup config using autoExternal to exclude all package.json dependencies from the bundle."},"warnings":[{"fix":"Place autoExternal as the first plugin in the plugins array.","message":"Plugins listed after autoExternal in the plugins array will still process external dependencies. Ensure autoExternal is placed before other plugins that transform code (e.g., babel) to avoid bundling dependencies.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Manually externalize dependencies from workspace packages or use a monorepo-aware plugin.","message":"autoExternal only respects dependencies, peerDependencies, and optionalDependencies from the root package.json. It does not handle monorepo structures or workspaces. Dependencies from nested packages will not be automatically externalized.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure package.json contains the relevant dependency fields, or manually configure external.","message":"If your package.json has no 'dependencies', 'peerDependencies', or 'optionalDependencies' fields, autoExternal will externalize nothing. This may lead to unintended bundling of dependencies that should be external.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade Rollup to >=0.45.2.","message":"Version 2.0.0 dropped support for Rollup <0.45.2. Plugins may fail silently or with cryptic errors if used with older Rollup versions.","severity":"breaking","affected_versions":">=2.0.0 <3.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use autoExternal() instead of 'auto-external' in plugins array.","cause":"Using plugin name string instead of function call.","error":"Error: Unexpected key 'auto-external' found in plugins"},{"fix":"Use `import autoExternal from 'rollup-plugin-auto-external'`.","cause":"Importing the plugin incorrectly (e.g., named import instead of default).","error":"TypeError: autoExternal is not a function"},{"fix":"Manually add a `globals` config for external dependencies or use output.format 'cjs'/'es'.","cause":"autoExternal externalizes a dependency but the output format (e.g., iife) requires a global variable name. The plugin does not provide globals mappings.","error":"(!) Missing global variable name\nhttps://rollupjs.org/..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}