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

Allow loading echarts library lazily via native import #246

Merged
merged 2 commits into from
Jul 24, 2020

Conversation

smnbbrv
Copy link
Contributor

@smnbbrv smnbbrv commented Jul 7, 2020

Hi @xieziyu

I did not bother you for a long time, it's time to do this again :)

The new way of importing the echarts is very heavy, because it loads the whole echarts in the application right away; however in most of my projects the echarts is a helper library which appears on several secondary pages.

Even if you make a custom build, it's still 170K gzipped which needs to be downloaded and parsed => performance goes down.

This PR aims this issue.

Actually I wanted to use this approach for protobuf Any data type at my https://github.com/ngx-grpc/ngx-grpc for a long time and always didn't have this time to implement it. So, sorry, but looks like we need to test it with ngx-echarts :)

The change is not breaking, and to use all its goodness one just need to change the imports in app.module.ts

NgxEchartsModule.forRoot({ echarts: () => import('./my-custom-echarts') }),

Please attack me if I miss something.

Thanks!

@xieziyu
Copy link
Owner

xieziyu commented Jul 24, 2020

Thank you!

@xieziyu xieziyu merged commit 9bb1f3a into xieziyu:master Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants