Cache NPM modules to save bandwidth and reduce download times – SPFx

Node Package Manager aka NPM is a package manager tool to download packages over the Internet. This is a very useful tool in the Open Source Environment where developers have the freedom to reuse modules already developed by other developers across the globe.

The above command will install all modules listed as dependencies in package.json

The package.json is the feeder for npm install. We often run in to an issue where we do not want to re-download packages again and again. Node has a package for this, npm-cache.

The npm-cache allows developers to cache the packages in the Appdata/Roaming/npm/ folder (This is hidden by default). So, when we use npm install, the package manager Hamster (I call it that way!) tries to first search the package in the locally cached packages and if not found, it then downloads it over the internet and then caches it to reuse for future use.


Leave a Reply

Next ArticleSharePoint Framework Custom Property Pane Fields