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

Use relative path for svg in Angular Library Component

I created a custom Library with Angular Cli. It has the following structure: - dist - projects - customLib - src - assets - icons - lib - button The button component gets as…
panagulis72
  • 2,129
  • 6
  • 31
  • 71
4
votes
0 answers

Using typings.d.ts in Angular library without tripple-slash reference

Within an Angular CLI workspace, I created a library foo. Within library foo, I added a typings.d.ts file. I then managed to reference a type defined in typings.d.ts from foo.module.ts using the Typescript triple-slash directive. Now, I would like…
Sam Herrmann
  • 6,293
  • 4
  • 31
  • 50
4
votes
0 answers

protractor + angular 6 library throw Error: ReferenceError: window is not defined

may I ask you why my app works with ng serve and ng build but if I run protractor, my e2e test fails with this message? [16:35:07] I/launcher - Running 1 instances of WebDriver [16:35:07] I/direct - Using ChromeDriver directly... [16:35:13]…
ms86
  • 227
  • 1
  • 7
4
votes
0 answers

protractor E/launcher - Error: ReferenceError: window is not defined

I had created an angular library with angular-cli v6 and ng-packagr that include ngx-bootstrap 3.0.1 as a peerDependency I have no problem running the app, but if I start protractor I get the folloing error: I/launcher - Running 1 instances of…
ms86
  • 227
  • 1
  • 7
4
votes
0 answers

protractor e2e test with angular library E/launcher - Error: ReferenceError: window is not defined

I have developed some angular libraries with angular-cli 6. Running the e2e the with protractor I have the following error: E/launcher - Error: ReferenceError: window is not defined at Object.
ms86
  • 227
  • 1
  • 7
4
votes
6 answers

ng-packagr: BUILD ERROR EPERM: operation not permitted

I followed this tutorial by Nikolas LeBlanc for building an Angular 4 Component Library. The tutorial describes a way to reuse a module in another project by packaging one project and installing it in the other. First, this are my software…
Kevin de Goede
  • 429
  • 6
  • 12
3
votes
0 answers

use require() in .mjs bundles - Angular 13

I recently upgraded my project to Angular 13, I noticed that the new ng-packgr 13 bundles in .mjs extension by default. I have lots of code that uses require() to import some static assets and files. I can change them to import() but is there any…
vp310
  • 300
  • 1
  • 9
3
votes
0 answers

In Angular 13 How to switch library build to .js output instead .mjs format

In Angular 13 the main app compiles in .js format but when we build library with ng build, output format are .mjs files Can we build libs to .js with ng build in Angular 13? I'm trying to use built .mjs library as custom plugin for webpack.config.ts…
Sergsar
  • 31
  • 3
3
votes
1 answer

Angular 12 Unable to load Schema — ng-package.schema.json file inside library

I did upgrade to angular 12 but I'm not able to build libraries anymore. = angular: v12.0.3, ng-packagr: 12.0.0 I'm running the following command ng build mylib --prod and get the following error Building Angular Package ERROR: Debug Failure. False…
Raphaël Balet
  • 6,334
  • 6
  • 41
  • 78
3
votes
1 answer

Angular Library with proper sub-entries

I am trying to build an Angular library following documentation but unfortunately I am getting some issues while building it. There are 2 main issues I am facing: 1st issue: Modules of the library are exported with full path import MyComponentModule…
Milos Miskone Sretin
  • 1,748
  • 2
  • 25
  • 46
3
votes
0 answers

'rootDir' is expected to contain all source files; Angular Library 10; Multiple Entry Points Error;

I'm trying to implement multiple entry points in to my angular library(similar to material library) & getting multiple errors. Environment Angular - 10.2.x TypeScript - 3.9.x ng-packagr - 10.1.x Library structure is as below @MyLib ├── src …
3
votes
1 answer

Angular library not build to es5 target

I have a Angular library which I need to build for es5 so it can be used in IE. I have followed this guide https://angular.io/guide/creating-libraries Here´s my file structure: In the tsconfig.lib.json I have changed to es5: /* To learn more about…
kodeaben
  • 1,829
  • 3
  • 24
  • 33
3
votes
0 answers

Creating an Uber Module of Modules in the same library?

I have a library that packages up several components and their corresponding modules. I can import those modules by themselves in an external application and they work fine. I tried to package them all up in an Uber module within the same library…
Ole
  • 41,793
  • 59
  • 191
  • 359
3
votes
1 answer

Angular library secondary entry points that depend on each other

I'm trying to make an angular library with secondary entry point for every module. I have three modules: A, B and C. A is standalone, but B depends on C, meaning I have import to get C.module.ts in B.module.ts. I followed this article, so I have a…
Matan Reuven
  • 95
  • 1
  • 10
3
votes
1 answer

Angular library ng-packagr doesn't replace tsconfig paths with relative paths

I have an Angular workspace (v10.0.2) containing a library and an app (for testing the library). Inside my projects/libname/src/lib/tsconfig.lib.json I have some paths: "baseUrl": "./src", "paths": { "@lib/*": ["lib/*"] } And I use it like…
Vahid
  • 6,639
  • 5
  • 37
  • 61