Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add public.api.ts #374

Open
andrei4ik1997 opened this issue Feb 23, 2024 · 7 comments
Open

Add public.api.ts #374

andrei4ik1997 opened this issue Feb 23, 2024 · 7 comments

Comments

@andrei4ik1997
Copy link

andrei4ik1997 commented Feb 23, 2024

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

@andrei4ik1997
Copy link
Author

@karolkolodziej
Copy link
Contributor

Hi @andrei4ik1997!

Thank you for creating the issue! We will investigate the possibilities here and will keep you posted.

@andrei4ik1997
Copy link
Author

Hi @karolkolodziej !
Thank you. I hope the problem is resolved soon

@andrei4ik1997
Copy link
Author

Hi @karolkolodziej, do you have any updates?

@karolkolodziej
Copy link
Contributor

HI @andrei4ik1997! Not much has changed. Due to time constraints, we were unable to fully investigate it. If you would like to suggest a solution, please feel free to do so. Your input is valuable to us in resolving this issue efficiently.

Thank you for your patience and understanding.

@kirill-borisyonok
Copy link

ПРИВЕТ@andrei4ik1997! Мало что изменилось. Из-за ограничений по времени мы не смогли полностью изучить его. Если вы хотите предложить решение, пожалуйста, не стесняйтесь. Ваш вклад ценен для нас в эффективном решении этой проблемы.

Благодарим вас за терпение и понимание.

@karolkolodziej maybe something has changed on this issue?

@karolkolodziej
Copy link
Contributor

I don't have any updates at the moment. If I come up with a solution or have more information, I'll share it here.

Thank you for your understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants