11

While building an angular 13 package with sub entries, I'm getting the warning below.

Building Angular Package
WARNING: Found configuration in ...<PATH_TO_PACKAGE>/package.json.
Configuring ng-packagr in "package.json" is deprecated. Use "ng-package.json" instead.

All the relevant info derived from ng version

Angular CLI: 13.0.4
Node: 16.13.0
Package Manager: yarn 1.22.17
OS: linux x64

Angular: 13.0.3
... animations, cdk, common, compiler, compiler-cli, core
... elements, forms, language-service, material
... material-moment-adapter, platform-browser
... platform-browser-dynamic, router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1300.3
@angular-devkit/build-angular   13.0.4
@angular-devkit/core            13.0.3
@angular-devkit/schematics      13.0.3
@angular/cli                    13.0.4
@schematics/angular             13.0.4
ng-packagr                      13.0.8
rxjs                            7.4.0
typescript                      4.4.4

Any idea if this is a false positive or how to tackle it since official ng-packagr documentation does not mention that usage of ng-packagr inside package.json is deprecated.

R. Richards
  • 24,603
  • 10
  • 64
  • 64
Rambou
  • 968
  • 9
  • 22

2 Answers2

12

You need to extract this from package.json

{
  "ngPackage": {
    "lib": {
      "entryFile": "public-api.ts",
    }
  }
}

to a new file ng-package.json this:

{
  "lib": {
    "entryFile": "public-api.ts"
  }
}

Checked in my library, works for me!

IMalaniak
  • 170
  • 1
  • 9
  • Thank you for this. Saved me from going nuts. Can you please post a link where this is officially documented? – Felix Dec 29 '21 at 04:03
  • 2
    I'm not asking for a solution. The solution is well explained in the warning message I'm getting from ng-packagr. What I'm asking for is why official documentation is not aligned with a deprecation message warning. According to the official docs they recommend to the consumers of this library to use ngPackage inside package.json. – Rambou Dec 29 '21 at 10:56
0

Agree above, I think it's just a warning for now, check the commit: https://github.com/ng-packagr/ng-packagr/commit/037ccf5cf30c1680251199b6affb7ecb0c89ee01