Using peer dependencies

In the event of developing a loader that is a simple wrapper (essentially, code that acts as a shell for more operational code within), the operational code—or package—should be included as peerDependency. This is because it will allow you to specify the exact version of the package using the package.json file.

In the following example, the sass-loader specifies node-sass as a peer dependency. Take a look at the code:

{
"peerDependencies": {
"node-sass": "^4.0.0"
}
}

This can be invaluable for compatibility issues, especially on complex programming projects.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.91.153