jvandemo / generator-angular2-library

Yeoman generator to create an Angular library
MIT License
752 stars 122 forks source link

Using a Third Party Js file in Npm Library #223

Closed rahulrsingh09 closed 6 years ago

rahulrsingh09 commented 7 years ago

I want to use Typed as well as untyped Js Libraries in My Project How to do this , I always get error if i try to import moment js

rahulrsingh09 commented 7 years ago

@Janatbek This is when you use Angular Cli but this wont work for this Library as this dosent use Cli.

I already Know about the same https://rahulrsingh09.github.io/AngularConcepts/faq

rahulrsingh09 commented 7 years ago

@Janatbek I want to embed the the third party js in this library not the app , I want this Library to be stand alone and using the third party js internally or as a peer dependency . i think you are not getting it

Janatbek commented 7 years ago

I am getting same issue now with third party JS library ))) let me know if you find any responce

izifortune commented 6 years ago

I'm not sure if this is on the roadmap but majority of the times its always better to use peerDependencies rather than embedded libraries.

https://nodejs.org/uk/blog/npm/peer-dependencies/

jdjuan commented 6 years ago

Agreed with @izifortune 👍 For general purposes it's better to let the consumer add needed dependencies by stating them as peerDependencies. Otherwise, the consumer might end up with momentjs twice if he has already imported it.

Closing it for now, @rahulrsingh09, feel free to re-open if you deem necessary 👍

jvandemo commented 6 years ago

That's indeed what peerDependencies are for 👍

Thank you @izifortune and @jdjuan 👍