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

Angular 6 - angular.json - copying assets with renaming

I am trying to rename a file during the assets copy of ng build Here is what I have used in angular.json: "outputPath": "dist", "assets": [ ..., { "glob": "favicon-v1.png", "input":…
Wand Maker
  • 18,476
  • 8
  • 53
  • 87
12
votes
3 answers

Function calls are not supported in decorators while ng build --prod (AOT)

Type of Issue: Bug / Question Description I'm using ng-packagr lib to compile my library to js. I've compiled everything without any problems, but when I'll want to consume my library with ng build --prod (AOT enabled), I'm getting error: ERROR in…
11
votes
1 answer

peerDependencies configuration for publishable libraries with NX & Angular

I have a monorepo using NX & Angular and I am publishing some libs to NPM and i have the following scenario apps only_App libs lib_A // v1.0.0 lib_B // v1.0.0 lib_C // v1.0.0 lib_A depends on lib_B and lib_C. In the pre-built…
Pato
  • 189
  • 1
  • 9
11
votes
2 answers

Configuring ng-packagr in "package.json" is deprecated

While building an angular 13 package with sub entries, I'm getting the warning below. Building Angular Package WARNING: Found configuration in .../package.json. Configuring ng-packagr in "package.json" is deprecated. Use…
Rambou
  • 968
  • 9
  • 22
11
votes
1 answer

Angular 5 service replacement/override

I created a core library for my project containing some components and services. I built the library with ng-packagr. In the consuming project which references the library I built my webapp containing components provided by the library. Nothing…
user970470
10
votes
2 answers

How do I declare/include an imported scss folder in my library so I can call @import it in my application's scss files?

The Goal: I am trying to include a path from my library so I can use an @import statement to include the scss files in my application like so: @import "some-scss-in-my-lib" The Problem: Unfortunately everytime I try to serve my application I am…
Fy Z1K
  • 618
  • 1
  • 7
  • 21
10
votes
0 answers

Can't build Angular library with SASS mixin from node modules

Setup: Angular 9 workspace with libraries, a test app and storybook using CDK's _overlay.scss in a .scss file with @use. .storybook/ node_modules/ projects/ - library/ - src/ - lib/ - component/ component.scss // `@use`s…
pfeileon
  • 290
  • 1
  • 17
10
votes
1 answer

Pack/Import a local developed module into a project

I am trying to import a locally developed Angular project/module into an angular application without publishing it into npm repository. First, I followed this tutorial to build my module in UMD format (I skipped the publish…
Strider
  • 3,539
  • 5
  • 32
  • 60
9
votes
3 answers

Angular 13 package/library throws error "moment is not a function" when imported into a Angular 13 project

Im upgrading a private angular library/package (my-lib) so i can migrate all other projects, but when imported into a project one of the services uses moment and throws an error: "ERROR TypeError: moment is not a function" The library works in dev…
9
votes
1 answer

How to pass SASS option to Angular library builder

I have an Angular 11 library using Bootstrap 4.5 ng-packagr uses SASS 1.34 which yields a lot of warning about the deprecation of the division operator, which is used a lot in Bootstrap…
Mistic
  • 1,377
  • 2
  • 13
  • 27
9
votes
1 answer

Use Postcss in Custom Angular Library

I used postcss, postcss-css-modules and posthtml-css-modules to implement CSS Modules in a Angular Application. I also used @angular-builders/custom-webpack to achieved this. Now, I want to do the same with my Custom Angular Library. However, I…
German Quinteros
  • 1,870
  • 9
  • 33
9
votes
1 answer

Angular 9 library with subentry points circular dependency

I have a very specific question about angular libraries secondary entry points setup. I really don't understand how i can setup it to get it work when they depend on each other including the main entry point. I've read the docs for the ng-packagr…
JohnnyDevNull
  • 951
  • 1
  • 8
  • 20
9
votes
1 answer

How to only have secondary entry points in ng-packagr

I have an Angular CLI library where each component should only be imported through their individual entry-points (like Angular Material) : import {Foo} from '@myLib/foo import {Bar} from '@myLib/bar So I don't want a main entry point in ng-packagr…
dex
  • 275
  • 1
  • 4
  • 10
9
votes
1 answer

How to import JSON file to Angular library?

I'm having trouble importing JSON file to my environment file in Angular 7 library. My environment.ts file looks like this: import firebase from './firebase.json'; export const environment = { production: false, firebase, }; And…
Gerda
  • 91
  • 1
  • 4
9
votes
1 answer

Add polyfill to Angular library

Is there a way within an Angular CLI project to have a library provide a polyfill? Within angular.json, the main app is by default configured with "polyfills": "src/polyfills.ts". This option is not available for a library project. My specific use…
Sam Herrmann
  • 6,293
  • 4
  • 31
  • 50
1
2
3
16 17