在文件夹内创建角度库 [英] Create angular lib inside folder
问题描述
我目前使用 cli 版本为 8.3.17 的 angular 8.
Hi I am currently using angular 8 with cli version 8.3.17.
我正在尝试在 libs 文件夹而不是普通项目文件夹中创建一个库
I am trying to create an library inside a libs folder instead of the normal projects folder
我试过跑步:
ng g lib libs/test**
但我收到错误:
项目名称libs/test"无效.新项目名称必须以开头带有字母,并且必须仅包含字母数字字符或破折号.添加破折号时,破折号后面的部分也必须开始用一封信.库/测试
Project name "libs/test" is not valid. New project names must start with a letter, and must contain only alphanumeric characters or dashes. When adding a dash the segment after the dash must also start with a letter. libs/test
推荐答案
在 angular.json 中,您可以将newProjectRoot"从projects"更改为libs",并通过运行 ng g lib test 创建库
- 请注意,您生成的任何应用程序也将具有此路径.或者,Nrwl NX 包含 cli 命令,这些命令默认在/libs 目录中生成库.
In your angular.json, you can change "newProjectRoot" from "projects" to "libs" and create the library by running ng g lib test
- just note that any apps you generate will also have this path.
Alternatively, Nrwl NX includes cli commands which generates libraries in a /libs directory by default.
这篇关于在文件夹内创建角度库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!