Skip to content

Add public.api.ts #374

Open
Open
@andrei4ik1997

Description

@andrei4ik1997

Please add public.api.ts file to the root of the library in which all functions will be exported. This is needed for the new ESBuild builder on Angular.
Builder does not accept paths with slashes(for example highcharts/highmaps)

After investgate and many attempts, I came to the conclusion that the Angular Esbuilder swears at import via / .
import Highcharts from 'highcharts'; It runs fine because the root folder contains a file with the same name as the library (highcharts.ts) and we don’t have to use the highcharts/highcharts import.
But as soon as I start using import Highcharts from 'highcharts/highcharts' (although this is the same as import Highcharts from 'highcharts') the builder starts not understanding this import path and throws an error
Therefore, I ask you to add the file to the root of the library public-api.ts or index.ts which exports all modules and charts from itself. So that we could use an import like import Highstock from 'highcharts;

I also managed to find a solution from @omishyn ( https://github.com/omishyn/om-angular-highcharts/tree/main ). He copies modules to the external layer using nf-copy.js . But I think this is a dirty solution. Maybe there is a better solution?
Maybe create index.ts/public.api.ts files will solve the problem?

P.s. Using the official wrapper (https://www.npmjs.com/package/highcharts-angular) doesn't solve the problem

index.ts examle
export * from './highcharts' export * from './highcharts-3d' export * from './highcharts-gantt' export * from './highcharts-more' export * from './highmaps' export * from './highstock' export * from './modules'

I am using native federation in my application.
https://www.npmjs.com/package/@angular-architects/native-federation

we also use polyfil es-module-shims. https://www.npmjs.com/package/es-module-shims

https://stackblitz.com/edit/stackblitz-starters-aptkaf?file=README.md
an example of the highcharts problem is located in the projects/mfe1/src/app/app.component.ts (app.component.) folder

you can also see the project here:
https://github.com/kirill-borisyonok/highcharts-issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions