-1

I have a angular library and I have that as .tgz file in my local. Now I want to use this library in one of my angular application. Is there a way, by which the dependency of library gets automatically installed when we run npm install (without adding the dependency in package.json).

Example:

Library depends on bootstrap, @angular/material, etc

In my project, by default I have not added any of the dependency mentioned above that library requires. I am just specifying the "sampleLibrary": "file:./libraries/sample-library.tgz" in package.json. If run npm install, I need to have all the dependency of sampleLibrary to get installed and available in node_modules.

mamichels
  • 619
  • 4
  • 12

1 Answers1

1

You need to list these dependencies under the dependencies key in the package.json file of the sampleLibrary. When you run npm install, NPM builds the dependency tree and installs all of the required modules. You can read more about the algorithm here.

Sebastian Kaczmarek
  • 8,120
  • 4
  • 20
  • 38