gpt4 book ai didi

ng-bootstrap - 依赖性@ ng-bootstrap/ng-bootstrap必须明确列入白名单

转载 作者:行者123 更新时间:2023-12-03 22:55:08 33 4
gpt4 key购买 nike

angular 6项目中,我使用angular cli命令ng g lierary @some/libName创建了 Angular 库。在我的库中,我有一个需要@ng-bootstrap/ng-bootstrap的组件,因此我是通过npm i --save @ng-bootstrap/ng-bootstrap添加的。

当我尝试使用ng build @some/libName --prod命令构建库时,抛出以下错误。

Dependency @ng-bootstrap/ng-bootstrap must be explicitly whiteliste

有人解决了吗?

最佳答案

更新资料
此警告来自 ng-packagr (and there's now a section of the ng-packagr docs about this)。原来ng-packagr只是告诉您它希望您将所有依赖项添加到"whitelistedNonPeerDependencies": []中的ng-package.json属性中。
例如:

{
"whitelistedNonPeerDependencies": [
"tslib",
...
]
}

原版的
自己碰到这个。我认为此警告来自 ng-packagr (angular-cli依赖于此生成和打包库)。我不确定“白名单”的含义,因为ng-packagr的文档中似乎没有直接解释该措词,但是 this issue in the ng-packagr repo对于解决该问题有很多不同的选择。
  1. Peers (such as Angular, RxJS): in this use case, the third-party dependency is a peerDependency of your library. Users of your library need to include both your library and the third-party library in their dependencies section.
  2. Embedding (e.g. legacy JS libraries): you have a legacy JavaScript library (e.g. an adapter to a proprietary backend) and you want to (need to) embed the legacy code in your library. In this case, the third-party dependency is a devDependency of your library and will be embedded into the bundle of your library.
  3. Mixed mode - embedded & peer (e.g. UX guidelines, Angularized styleguide): in this use case, the third-party dependency is a peerDependency but also (partially) embedded in your library. You may want to re-use existing CSS/SCSS/LESS stylesheets from the third-party library in your library, thus "embedding" code from the third-party in your library. At the same time, the third-party dependency is a peerDependency of your library.

The github issue对此有更多信息。

关于ng-bootstrap - 依赖性@ ng-bootstrap/ng-bootstrap必须明确列入白名单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50306714/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com