在文件夹内创建有角度的lib [英] 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.
这篇关于在文件夹内创建有角度的lib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!