amplitude / Amplitude-JavaScript

JavaScript SDK for Amplitude
MIT License
314 stars 132 forks source link

Tree shaking support #402

Open gugu opened 3 years ago

gugu commented 3 years ago

Summary

For people, who use a subset api Amplitude API loading the whole library is an overhead. We are optimizing the project to make login/registration pages very fast to load and amplitude (unminified, 200kb) currently has size of our whole UI library + React-DOM combined. The only functions we use are logEvent and setUserProperties

Motivations

Lots of libraries (like date-fns or lodash) allow to import specific functions instead of the whole large module

JulianRomana commented 2 years ago

Hi there ! Are there any news on this? For the context, we have an npm package that uses amplitude-js to log events from our different front-end projects to our amplitude instance. So a fairly simple usage since we only need in fact the getInstance function. But currently it makes our project weight 233.72KB (16KB without amplitude-js).

Thank you for your response in advance!

kevinpagtakhan commented 2 years ago

Hi all, thanks for the suggestion. This is part of our roadmap and we are hoping to support this by early next year.

PawFV commented 2 years ago

any updates on this? having the same issue

But currently it makes our project weight 233.72KB (16KB without amplitude-js).

kevinpagtakhan commented 2 years ago

Announcement 📣

Amplitude is introducing a new TypeScript SDK for Browser [BETA]. This new SDK provides improved developer experience, helps users instrument data more seamlessly and provide more control over data being instrumented using custom plugins. The new SDKs also comes with:

To learn more about the new SDK, here are some useful links: