Configuring ng-packagr in "package.json" is deprecated
Asked Answered
V

2

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.

Vermin answered 2/12, 2021 at 14:11 Comment(0)
S
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!

Scutum answered 20/12, 2021 at 12:56 Comment(2)
Thank you for this. Saved me from going nuts. Can you please post a link where this is officially documented?Neilla
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.Vermin
H
-1

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

Higgle answered 21/12, 2021 at 10:9 Comment(2)
Bring nothing new to the question.Sensualism
I've already checked that commit. The question is more oriented on what should we do for the future. Since it is not mentioned in their documentation.Vermin

© 2022 - 2024 — McMap. All rights reserved.