
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
rollup-plugin-peer-deps-external
Advanced tools
Rollup plugin to automatically add a library's peerDependencies to its bundle's external config.
Automatically externalize peerDependencies in a rollup bundle.
When bundling a library using rollup, we generally want to keep from including peerDependencies since they are expected to be provided by the consumer of the library. By excluding these dependencies, we keep bundle size down and avoid bundling duplicate dependencies.
We can achieve this using the rollup external configuration option, providing it a list of the peer dependencies to exclude from the bundle. This plugin automates the process, automatically adding a library's peerDependencies to the external configuration.
npm install --save-dev rollup-plugin-peer-deps-external
// Add to plugins array in rollup.config.js
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
export default {
plugins: [
// Preferably set as first plugin.
peerDepsExternal(),
],
}
If your package.json is not in the current working directory you can specify the path to the file
// Add to plugins array in rollup.config.js
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
export default {
plugins: [
// Preferably set as first plugin.
peerDepsExternal({
packageJsonPath: 'my/folder/package.json'
}),
],
}
Set includeDependencies to true to also externalize regular dependencies in addition to peer deps.
// Add to plugins array in rollup.config.js
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
export default {
plugins: [
// Preferably set as first plugin.
peerDepsExternal({
includeDependencies: true,
}),
],
}
This plugin is compatible with module path format applied by, for example, babel-plugin-lodash. For any module name in peerDependencies, all paths beginning with that module name will also be added to external.
E.g.: If lodash is in peerDependencies, an import of lodash/map would be added to externals.
The rollup-plugin-auto-external package automatically marks dependencies and peer dependencies as external. It provides more flexibility by allowing you to configure which dependencies to externalize. Compared to rollup-plugin-peer-deps-external, it offers a broader scope by including regular dependencies as well.
The rollup-plugin-node-externals package is another Rollup plugin that marks Node.js built-in modules and dependencies as external. It is more comprehensive in scope, as it can handle built-in modules, dependencies, and peer dependencies. This makes it a good choice for Node.js projects that need to externalize a wide range of modules.
FAQs
Rollup plugin to automatically add a library's peerDependencies to its bundle's external config.
The npm package rollup-plugin-peer-deps-external receives a total of 325,904 weekly downloads. As such, rollup-plugin-peer-deps-external popularity was classified as popular.
We found that rollup-plugin-peer-deps-external demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.