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
8
votes
1 answer

'Unsupported private class xy' while building Angular library

I'm developing an npm package with Angular. While building the lib, I get the following error: Unsupported private class MyLibComponent. This class is visible to consumers via MyLibModule -> MyLibComponent, but is not exported from the top-level…
Hugo B.
  • 471
  • 1
  • 8
  • 23
8
votes
3 answers

Cannot read property 'module' of undefined while building angular lib

I am converting an angular app to angular lib. I generated angular lib project and slowly moving the modules. I now get the following error while building the library. ng build lib Error Cannot read property 'module' of undefined TypeError: Cannot…
Abhishek
  • 621
  • 1
  • 8
  • 19
8
votes
2 answers

How to bundle vendor fonts when creating libraries with Angular cli

I am creating a component library with the Angular CLI (v7.x) and am having trouble figuring out how I get 3rd party font assets needed for css rules to be included in my dist folder generated by ng-packagr. Due to ng-packagr not supporting scss…
mindparse
  • 6,115
  • 27
  • 90
  • 191
8
votes
1 answer

How to include third party modules in an Angular library created using the CLI

I'd like to use the Pure.css module in an Angular library created with the CLI generate library command. I have a workspace app in which I have ran the generate library command to create the library. The library was successfully created and I was…
Thabo
  • 1,303
  • 2
  • 19
  • 40
8
votes
2 answers

APP_INITIALIZER in library causes "Lambda not supported" error

When defining an APP_INITIALIZER in a library module, the build fails with the Lambda not supported error. The build error is thrown when the function is exported as per docs: import { NgModule, APP_INITIALIZER } from '@angular/core'; import {…
Sam Herrmann
  • 6,293
  • 4
  • 31
  • 50
7
votes
0 answers

Error during template compile of 'Injectable' Function calls are not supported in decorators but 'ɵmakeDecorator' was called

I am trying to create an angular package using ng-packagr. I have added the following script into my package json in order to build the package "scripts": { "build:lib": "ng-packagr -p lib/package.json"}, However, I am getting the following…
Rasula Caldera
  • 305
  • 1
  • 9
7
votes
2 answers

Angular6.x Library not exposing all members in public_api.ts

After updating my project to the latest version of Angular (6.0.4) i wanted to finally separate my code into different libraries. The setup is as followed: CMS - app Client - app Core - Library with shared members for both apps I created 3 empty…
Linksonder
  • 732
  • 2
  • 8
  • 17
7
votes
2 answers

NullInjectorError: No provider for StateObservable when using ng-packagr

I have an Angular 5 project that uses ngrx/store. The project consists of an application and a shared library that the application uses. Up until today, we had been compiling the TypeScript for both projects together - the library was being…
Joe Attardi
  • 4,381
  • 3
  • 39
  • 41
6
votes
1 answer

ngrx store selector failing on app import from custom library

I have an angular library with store implementation and this library is packaged as a NPM and used in different angular application. I'm trying to use a ngrx store selector which was exported in the library in my different angular project and the…
imPK
  • 764
  • 2
  • 7
  • 30
6
votes
0 answers

ng-packagr extend rollup config

I have a Custom Angular Library and I would like to customize the build of that Library using postcss. Like the Angular Libraries are built using ng-packagr, I need to extend the rollup.config.js of ng-packagr to customize the build of my…
German Quinteros
  • 1,870
  • 9
  • 33
6
votes
0 answers

How to use assets bundled with ng-packagr in angular library

I try to bundle some assets into my published angular library. Within my angular workspace, I located the assets in the src-folder with the following ng-package.json { "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", "dest":…
andreas.teich
  • 789
  • 1
  • 12
  • 22
6
votes
2 answers

Is there a better way to build an Angular monorepo app with libraries?

I have several apps in my Angular monorepo project. Also there are about 5 libraries I've written to use across the apps. What I want to know is how to better build/architect these libraries. The ins are follows: Libraries are for internal usage…
Sergey
  • 7,184
  • 13
  • 42
  • 85
6
votes
0 answers

Package external dependencies in same UMD

Using tools like rollup or ng-packagr (for angular) you can create the UMD bundle of your code easily. By default, dependencies will be treated as external dependencies and not bundled in the generated module. For example, ng-packagr does this by…
Rambou
  • 968
  • 9
  • 22
6
votes
1 answer

Is it possible for angular lib to use nested public_api.ts

A very big library I am creating, so naturally I am thinking to modularise the public_api.ts for different huge modules. But it seems I cannot achieve that via something like this in the root public_api.ts: export * from…
Hearen
  • 7,420
  • 4
  • 53
  • 63
6
votes
0 answers

Is there a way to extract css using ng-packagr with Angular 6?

I'm currently working on an Angular 6 project containing multiple libraries built and released using ng-packagr. One of those libraries is a component library. As such, it contains multiple component each of them with their own scss. As part of the…
L Tiger
  • 551
  • 2
  • 8
1 2
3
16 17