Registry /
web-framework / peer-deps-externals-webpack-plugin
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
PeerDepsExternalsPlugin
✓ const PeerDepsExternalsPlugin = require('peer-deps-externals-webpack-plugin');
✗ import PeerDepsExternalsPlugin from 'peer-deps-externals-webpack-plugin';
CommonJS require is the standard for webpack configs; ESM syntax may not work depending on Node.js version and project configuration.
PeerDepsExternalsPlugin
✓ const { PeerDepsExternalsPlugin } = require('peer-deps-externals-webpack-plugin');
✗ const PeerDepsExternalsPlugin = require('peer-deps-externals-webpack-plugin').PeerDepsExternalsPlugin;
Default export is a function, not an object; destructuring the named export is incorrect.
PeerDepsExternalsPlugin (type)
✓ import PeerDepsExternalsPlugin from 'peer-deps-externals-webpack-plugin';
✗ import { PeerDepsExternalsPlugin } from 'peer-deps-externals-webpack-plugin';
TypeScript users: the package does not ship type definitions; use @types/peer-deps-externals-webpack-plugin if available or declare module.
Configures webpack to automatically exclude peer dependencies from the bundle using PeerDepsExternalsPlugin.
// webpack.config.js
const PeerDepsExternalsPlugin = require('peer-deps-externals-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
path: __dirname + '/dist',
filename: 'bundle.js',
libraryTarget: 'commonjs2', // or 'umd' for libraries
},
plugins: [
new PeerDepsExternalsPlugin(),
],
};
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'react'
React is a peerDependency but not excluded from the bundle because PeerDepsExternalsPlugin is not configured.
fixAdd `new PeerDepsExternalsPlugin()` to webpack plugins array.
TypeError: PeerDepsExternalsPlugin is not a constructor
Importing the plugin incorrectly (e.g., using named import when it's a default export).
fixUse `const PeerDepsExternalsPlugin = require('peer-deps-externals-webpack-plugin');` ./node_modules/.bin/webpack: line 1: unexpected EOF while looking for matching ``'
Shell quoting issue when peerDependencies contain environment variable syntax (e.g., ${npm_package_peerDependencies}) in older versions.
fixUpgrade webpack and the plugin to latest versions; or avoid using shell variables in peerDependencies.
Audit
Dependencies
webpackrequiredpeer dependency; webpack >=2.0.0 required