gpt4 book ai didi

Angular 服务库

转载 作者:太空狗 更新时间:2023-10-29 18:22:15 25 4
gpt4 key购买 nike

在最新版本的 Angular cli 中,我们可以使用 ng g library lib-name 命令来创建库。如 Angular docs 中所述:

ng serve <project>

和:

<project>   The name of the project to build. Can be an app or a library.

因此,我们可以为图书馆提供服务。但是当我发球时,出现以下错误:

Project 'ngx-tab-component' does not support the 'serve' target.
Error: Project 'ngx-tab-component' does not support the 'serve' target.
at ServeCommand.initialize (C:\Users\vahidnajafi\angular\ngx-tab-app\node_modules\@angular\cli\models\architect-command.js:53:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3

最佳答案

您可以从

更新主要 tsconfig.json 中的路径
"paths": {
"library": {
"dist/library"
}
}

"paths": {
"library": {
"projects/library/src/public-api"
}
}

然后你不需要为你的库开始单独的构建并且重建也可以。

关于 Angular 服务库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54146811/

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