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

Tree shaking support #402

Open
gugu opened this issue Jun 7, 2021 · 4 comments
Open

Tree shaking support #402

gugu opened this issue Jun 7, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@gugu
Copy link

gugu commented Jun 7, 2021

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

@gugu gugu added the enhancement New feature or request label Jun 7, 2021
@JulianRomana
Copy link

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
Copy link
Contributor

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

@PawFV
Copy link

PawFV commented Apr 8, 2022

any updates on this? having the same issue

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

@kevinpagtakhan
Copy link
Contributor

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:

  • Browser env support
  • Web worker env support
  • Server-side rendering framework support (ie Next.js)
  • Tree-shaking support
  • Custom plugins
  • Built-in type definitions

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants