Peer Dependencies - Explained

Published: 11 February 2023
on channel: A shot of code
7,492
220

Peer Dependencies in NPM are often used to aid package management for plugins. In this tutorial video we look at why peer Dependencies are needed and the benefits they proved, how to add peer Dependencies to the package JSON file and then how to resolve the warnings/errors that are associated with peer Dependencies during NPM installs.

00:55 Create Test Application
03:50 Push Test Application to NPM
04:10 Install and Test Application
05:00 Create Test Application Plugin
06:00 Publish Test Application Plugin to NPM
06:30 Scenario 1 - Happy Case App and Plugin work together successfully
07:15 Scenario 2 - App API is updated with breaking change - no Peer Dependency to help us
07:30 API changed in App and version changed to v1
08:30 Install V1 of App - No Errors or Warnings
08:50 Run time error!
09:40 Scenario 3 - Using Peer Dependency on Plugin
10:20 Update version of Plugin to 10.0.2
11:30 Peer Dependency Warning on attempting to install plugin against V1 of App
13:20 Scenario 4 - Installing Plugin with App V1 - peer dependency should warn/error
14:40 Install Plugin shows Error and blocks install
15:40 Force install of Plugin


Watch video Peer Dependencies - Explained online without registration, duration hours minute second in high quality. This video was added by user A shot of code 11 February 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 7,492 once and liked it 220 people.