canirequire › CommonJS › rollup-plugin-peer-deps-external
Is rollup-plugin-peer-deps-external ESM-only? Can you require() it?
Rollup plugin to automatically add a library's peerDependencies to its bundle's external config.
Last verified Sep 9, 2026 against rollup-plugin-peer-deps-external@2.2.4. JSON
CommonJS CommonJS — require() works on every Node.js version
rollup-plugin-peer-deps-external ships CommonJS only. require("rollup-plugin-peer-deps-external") works everywhere. import "rollup-plugin-peer-deps-external" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.
It also declares a "module" field, so bundlers such as webpack, Vite and esbuild pick up an ESM build for tree-shaking.
Does rollup-plugin-peer-deps-external@2.2.4 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("rollup-plugin-peer-deps-external") from a CommonJS file and import "rollup-plugin-peer-deps-external" from an ES module.
| Runtime | require("rollup-plugin-peer-deps-external") | import "rollup-plugin-peer-deps-external" |
|---|---|---|
| Node.js 18 | ✓ works | ✓ works |
| Node.js 20 | ✓ works | ✓ works |
| Node.js 22 | ✓ works | ✓ works |
| Node.js 24 | ✓ works | ✓ works |
| Node.js 26 | ✓ works | ✓ works |
| Bun 1.4 | ✓ works | ✓ works |
How to import rollup-plugin-peer-deps-external
ES modules (import)
import rollupPluginPeerDepsExternal from "rollup-plugin-peer-deps-external";Named imports from a CommonJS package only work when Node.js can statically detect them. If a named import fails, use the default import and destructure.
CommonJS (require)
const rollupPluginPeerDepsExternal = require("rollup-plugin-peer-deps-external");Module format by version
Derived from the type, main and exports fields of every stable release on npm (9 versions; the newest 9 shown).
| Versions | Format | First published |
|---|---|---|
| 1.0.0 – 2.2.4 | CommonJS | Apr 12, 2017 |
Frequently asked
Is rollup-plugin-peer-deps-external ESM-only?
rollup-plugin-peer-deps-external@2.2.4 is a CommonJS package. rollup-plugin-peer-deps-external ships CommonJS only. require("rollup-plugin-peer-deps-external") works everywhere. import "rollup-plugin-peer-deps-external" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.
Can I import rollup-plugin-peer-deps-external with ES module syntax?
Yes. import rollupPluginPeerDepsExternal from "rollup-plugin-peer-deps-external" works in Node.js and Bun because they support importing CommonJS modules. Named imports work only when Node.js can statically detect the exports.
Does rollup-plugin-peer-deps-external work in Bun?
Yes. import "rollup-plugin-peer-deps-external" loaded successfully in Bun 1.4 on Sep 9, 2026.
Does rollup-plugin-peer-deps-external ship TypeScript types?
Not bundled. Install the community types with "npm install -D @types/rollup-plugin-peer-deps-external".
Links
Other commonjs packages
- debug 4.4.3CommonJS
- semver 7.8.5CommonJS
- ms 2.1.3CommonJS
- picomatch 4.0.7CommonJS
- ajv 8.20.0CommonJS
- source-map 0.8.0CommonJS
- react-is 19.2.8CommonJS
- readable-stream 4.7.0CommonJS
Similar popularity
- yorkie 2.0.0CommonJS
- babel-plugin-transform-runtime 6.23.0CommonJS
- cookie-session 2.1.1CommonJS
- babel-preset-stage-1 6.24.1CommonJS
- gulp-header 2.0.12CommonJS
- chalk-animation 2.0.3ESM-only
- svelte-preprocess 6.0.5CommonJS
- grunt-contrib-concat 2.1.0CommonJS