Creating a new library with Angular 6+

rudolfolah profile image Rudolf Olah ・1 min read

The directory structure for an Angular project changed in v6, so here's the process for creating a new library for Angular 6+:

~/Code$ ng new my-angular-library --create-application false

When creating a new Angular project this way, the Angular CLI will not generate any application files, just the base project workspace.

Then you do this:

~/Code$ cd my-angular-library
~/Code$ ng g library my-lib

The root directory, my-angular-library, can contain many projects which will be in the projects directory. The path to your new library will be projects/my-lib.

You can build the library by running ng build in the top-level workspace directory or in the projects/my-lib directory.


markdown guide