Questions tagged [ng-packagr]

a tool to transpile your libraries to Angular Package Format

Resources:

  1. GitHub: https://github.com/dherges/ng-packagr
  2. NPM: https://www.npmjs.com/package/ng-packagr
  3. Example: https://github.com/dherges/ng-packaged
247 questions
65
votes
3 answers

Include assets when building angular library

I am building a library which contains a custom icon font. However, when I build my library using ng build --prod, the assets folder is not included in the build, which means icons do not show up when using the production build. I've…
50
votes
6 answers

'rootDir' is expected to contain all source files

I have an Angular CLI workspace containing two library projects, foo and bar. When I build the second of the two libraries, foo, the build fails with the following error: error TS6059: File '/code/projects/bar/src/lib/types.ts' is not under …
Sam Herrmann
  • 6,293
  • 4
  • 31
  • 50
31
votes
2 answers

Packaging an Angular library with i18n support

Angular's i18n is great, and tools like ng-packagr makes component library packaging extremely easy, but can they be combined? What if i want to package and distribute a component library having translatable components? Is it possible? How do I…
leonixyz
  • 1,130
  • 15
  • 28
29
votes
3 answers

ng-packagr gives No name was provided for external module

When using ng-packagr to package up one project @my/common-util, there are no problems. This class contains an abstract class called AbstractPerson in abstract-person.ts. In another project called @my/common-impl, another Person class was created…
AngularAngle
  • 291
  • 1
  • 3
  • 5
28
votes
5 answers

Include assets when building library using ng-packagr

Could anyone give a hint where to start to include images and css files into Angular library using ng-packagr?
Algis
  • 612
  • 1
  • 8
  • 23
25
votes
5 answers

Angular 6 building a library with assets

Upon building & packaging an Angular 6 library, I can't seem to be able to instruct the Angular CLI to copy the library's assets into the dist/assets folder on every build. Assuming the project's folder structure is this - - dist - e2e -…
dev7
  • 6,259
  • 6
  • 32
  • 65
23
votes
5 answers

Keeping version numbers in sync in angular library project package.json files

When building an Angular Library application, is there an automated way to keep the root level package.json and the library application's package.json (e.g. under projects/my-library) file versions in sync when using npm version commands? When I use…
mindparse
  • 6,115
  • 27
  • 90
  • 191
22
votes
1 answer

How to mix Angular Elements with the "ng g library" approach?

As you know, the "ng g library" approach helps us with the creation of libraries of reusable components. But what if I wanted those components to be compiled into web components... through the support of Angular Elements? Not only that but also that…
Fabio Nolasco
  • 7,122
  • 6
  • 35
  • 32
22
votes
4 answers

Configuration 'production' could not be found in project 'my-lib'

I am building a library with Angular 6.1.0 ng new lib-demo ng generate library my-lib All the articles advise running the build for the library with a --prod flag like so: ng build my-lib --prod However, this throws an error Configuration…
Himanshu Arora
  • 2,368
  • 3
  • 22
  • 33
22
votes
6 answers

How do you debug an Angular 6 library

I'm writing an Angular 6 Library and cannot figure out how to step into the typescript. I generated the app using: ng new mylibapp I then added the library using: ng g library @abc/cool-lib -p abc when I perform: ng build @abc/cool-lib it generates…
JoAMoS
  • 1,459
  • 3
  • 18
  • 27
19
votes
1 answer

WARNING: No name was provided for external module 'X' in output.globals – guessing 'X'

WARNING: No name was provided for external module 'moment' in output.globals – guessing 'momentImported' WARNING: No name was provided for external module 'odata-parser' in output.globals – guessing 'parser' I receive this message when I try to…
ROMAN
  • 1,476
  • 2
  • 11
  • 24
18
votes
3 answers

angular-cli library create secondary entry point

I am trying to create what I believe is called a secondary entry point into my angular npm package. I want the following two entry points @scope/data-service @scope/data-service/models Using the angular-cli to generate the base package generates…
JoAMoS
  • 1,459
  • 3
  • 18
  • 27
17
votes
1 answer

How to create an Angular wrapper around an existing Javascript library?

I have a pure javascript library that users can install via npm. I want to add/create an Angular "wrapper" to this library so that it can be used seamlessly within Angular projects but I am not sure how to do this. I am using Angular-cli v6. This…
LockettKs
  • 415
  • 4
  • 10
12
votes
8 answers

"Maximum call stack size exceeded" in Angular 9 ng build --prod for a library

I have a library that I'm able to compile with Angular 9. But if I change the flag to --prod, which practically makes "enableIvy": false then I get [error] RangeError: Maximum call stack size exceeded at Object.pathIsRelative…
Adrian Ber
  • 20,474
  • 12
  • 67
  • 117
12
votes
2 answers

Warnings of unused imports when packaging libs

I am working on an Nx powered monorepo, building a bunch of libs written in angular and packaged with ng-packagr. When building the sources I am seeing a bunch of warnings like this: WARNING: "DomSanitizer" is imported from external module…
mindparse
  • 6,115
  • 27
  • 90
  • 191
1
2 3
16 17