![]() ![]() Hence, technically we wouldn’t need to bother adding them to our list of dependencies. Yes, we can usually assume that for our Angular specific library the Workspace will already have the Angular packages available. Given that you are going to specify in your documentation that your library is a set of Angular Components and Services, you may be asking the question: “Do I even need to specify angular/core as a dependency? If someone is using my library, they will already have an existing Angular project.” For example, you will want to be specific about which version of Angular your library is compatible with. Well, as with most technical questions: it depends. So this brings us to the main question for our dependencies: When my package depends on another package, should I put it in dependencies or peerDependencies? The key is: We don’t want our library adding another version of a package to node-modules when that package could conflict with an existing version and cause problems. ![]() ![]() We wouldn’t want our package adding another completely different version of angular/core when someone adds it as a dependency to their Angular 6 application. However, some packages will cause conflicts when there are two different versions of them in the same code base.įor example, assume our component library was created using Angular 5. Sometimes, having two versions of the same package is fine. As we saw from our experiment with npm version conflicts, if you add a package to your dependencies, there is a chance it may end up being duplicated in node_modules. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |