Jmainol
Jmainol

Reputation: 437

How to include third-party library into Angular Library Module?

I created an Angular Library within an Angular App:

ng new zts-button --create-application=false
cd zts-button
ng g lib lib-zts-button

Then I created a button module within Angular Library and I need to use fontawesome in it. I install fontawesome this way:

npm install --save @fortawesome/fontawesome-free

and I reference it into my library´s package.json as a peerdependencie

After create my library´s dist folder and .tgz file, when I try to consume my button module in an independent angular app by:

npm install ../some-relative-path/dist/my-file.tgz

This host angular app has no reference of fontawesome library of my button module. I would like it to has the reference and install fontawesome when I try to consume my library module on it.

Upvotes: 2

Views: 2595

Answers (1)

Zain_Ul_Abiddin
Zain_Ul_Abiddin

Reputation: 46

Whichever third-party library you use in developing your components in your own library you need to list that library as a dependency in your libraries package.json. This way when you install your library in any angular project all the dependencies of your custom made library will also get installed.

Upvotes: 1

Related Questions