Framework dependencies listed as peerDependencies
Why it matters
Listing React, Vue, or any consumer-provided framework in dependencies instead of peerDependencies installs a second copy of that framework in the consumer's node_modules. For React specifically, this triggers the infamous "Invalid hook call" error because two separate React instances exist at runtime — a hard crash, not a degraded experience. It also silently doubles the framework's bundle weight. SSDF PS.3.2 flags this as a supply chain concern: you're injecting unverified versions of major frameworks into consumer apps. ISO 25010 interoperability fails when your version range conflicts with the host app.
Severity rationale
High because duplicate framework installations cause runtime crashes (React hooks, Vue reactivity) and inflated bundle sizes that directly affect the end user.
Remediation
Move framework dependencies from dependencies to peerDependencies with broad version ranges, and keep them in devDependencies for local development.
{
"peerDependencies": {
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
"devDependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
}
}
For optional peer dependencies (e.g., a Vue adapter that's only needed for Vue users), add a peerDependenciesMeta entry: { "vue": { "optional": true } }. Test with the oldest and newest versions in your peer range.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the SDK / Package Quality Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · compatibility.interoperability — Interoperability — peer dep version alignment prevents duplicate runtime instances
- ssdf:800-218 · PO.3.2 — Review and update software dependency requirements
- slsa:1.0 · L1 — SLSA L1 — provenance of transitive dependencies
Taxons
History
- 2026-04-18·v1.0.0·Initial import from sdk-package-quality·automated