Search code examples
angularng-packagr

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 "./lib/lib2-m1/public_api";
export * from "./lib/lib2-m2/public_api";

And also the ng-package.json used by ng-packagr is using entryFile which is a singular.

A simple demo to present the case.

Any idea will be appreciated for better modularisation of the big lib.


Solution

  • You can try creating index.ts file with public-api.ts file and use that index file in root public-api.ts file in root public-api.ts

    export * from "./lib/lib2-m1/index";
    export * from "./lib/lib2-m2/index";
    

    This worked in my project.