Tip 48 Leverage Community Knowledge with npm

In this tip, you’ll learn how to import external code with npm.

In the previous tip, you learned how to use code from different files. In this tip, you’ll learn how to use community code created by developers all over the world.

Not many years ago, if you wanted to use an open source library, you were forced to either copy-paste code locally, download a library to your project, or include an external dependency using a <script> tag in your markup.

You’d get your code—unless an external source went down—but it was hard to keep dependencies up to date, particularly if you were storing them locally. Not only was it hard to maintain, but you also had to write your custom code assuming the library ...

Get Simplifying JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.