No video

Peer Dependencies - Explained

  Рет қаралды 6,838

A shot of code

A shot of code

Күн бұрын

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

Пікірлер: 15
@pensandocomodev
@pensandocomodev Жыл бұрын
WOW! I'm currently going through that phase of updating my project's dependencies versions and needed to understand better about peerDependencies, because my company is using a monorepo, where it has multiple different libraries and some libraries depends on another libraries and eventually it all boils down to an app. I was just looking for this answer and bumped into your video and the way that you explained such a complex topic is mind blowing 🤯. You even got me thinking about another scenario that we have, when an application may opt-out of certain "sub dependencies" and really inspired me to keep on working on this task today. NPM library creation content are so difficult to find and yours was just **perfect**. tysm!!
@pensandocomodev
@pensandocomodev Жыл бұрын
I do have one question though. Let's say I have an app that uses a library (created by me) that depends on the styled-components package. The styled-components package has a peerDependency "react-is". Should I add this peerDependency: a) as a *dependency* for my library? b) as a *peerDependency* for my library and as a *dependency* on my app? c) other - please explain
@stephenhu118
@stephenhu118 4 ай бұрын
I like your examples which really helped me to understand what peer dependencies really are.
@Ashotofcode
@Ashotofcode 3 ай бұрын
Excellent, glad it was helpful :-) Cheers Mark
@nyarlaaa
@nyarlaaa Жыл бұрын
Thanks for the helpful video. I've had to take over a project that hasn't been updated for years and with the "new" npm being more strict and angular's lackluster documentation it's been a right headache.
@Ashotofcode
@Ashotofcode Жыл бұрын
Great to hear! Cheers Mark 🙂
@Middollo
@Middollo 4 ай бұрын
Thank you! Great examples!
@Ashotofcode
@Ashotofcode 4 ай бұрын
Glad it was helpful! Cheers Mark
@shubhsingh4935
@shubhsingh4935 3 ай бұрын
Thankyou, It really helped :)
@Ashotofcode
@Ashotofcode 2 ай бұрын
You're welcome!
@mehmetsayn573
@mehmetsayn573 Жыл бұрын
what about using package.json overrides in this case ? is not it better than using force or peer deph ?
@cairink2110
@cairink2110 Жыл бұрын
I am updating my nextjs app and I installed(upgraded) packages with "--force" . It installed the packages, but "npm i" still gives the error. Will this be a problem when deploying on vercel?
@Ashotofcode
@Ashotofcode Жыл бұрын
The error is just a warning once you have forced the install - just reminds you that there is no official support for the current setup you have and there may be mismatches. When you deploy as long as you are not running npm on the sever and just pushing up the locally built package then should be fine. Cheers Mark
@justkaz7104
@justkaz7104 8 ай бұрын
105
@juanfut11
@juanfut11 7 ай бұрын
Wasted 18 minutes for nothing
JavaScript Promises  -- Tutorial for Beginners
37:05
ColorCode
Рет қаралды 119 М.
App Builder - Server-Side Swift #08
22:18
arconsis
Рет қаралды 102
Joker can't swim!#joker #shorts
00:46
Untitled Joker
Рет қаралды 40 МЛН
Пройди игру и получи 5 чупа-чупсов (2024)
00:49
Екатерина Ковалева
Рет қаралды 4,3 МЛН
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 17 МЛН
Разные зависимости в package.json / dev, optional, peer, bundle
46:41
Игорь Антонов — про JavaScript и разработку
Рет қаралды 1,8 М.
How npm resolves dependency hell | Must know!
9:56
Mayank Srivastava
Рет қаралды 8 М.
Using TailwindCSS with LitElement
12:07
A shot of code
Рет қаралды 3,2 М.
package.json is not enough
15:40
Hussein Nasser
Рет қаралды 53 М.
Turns out REST APIs weren't the answer (and that's OK!)
10:38
Dylan Beattie
Рет қаралды 151 М.
Why I decided to switch to the inject() function in Angular
6:10
Joshua Morony
Рет қаралды 57 М.
Git Rebase Visualized
10:46
A shot of code
Рет қаралды 5 М.
Understanding Package-lock.Json | Javascript Tutorial
12:50
The Code Creative
Рет қаралды 7 М.
#20: peerDependencies in package.json - Mastering NPM
5:06
Mehul - Codedamn
Рет қаралды 32 М.
10 common mistakes with the Next.js App Router
20:37
Vercel
Рет қаралды 206 М.
Joker can't swim!#joker #shorts
00:46
Untitled Joker
Рет қаралды 40 МЛН