Create angular lib inside folder

拜拜、爱过 提交于 2021-02-11 06:11:35

问题


Hi I am currently using angular 8 with cli version 8.3.17.

I am trying to create an library inside a libs folder instead of the normal projects folder

I tried running:

ng g lib libs/test**

but I get the error:

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


回答1:


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.



来源:https://stackoverflow.com/questions/58739484/create-angular-lib-inside-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!