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

Split modules to facilitate custom builds #172

Conversation

DullReferenceException
Copy link

mixpanel-browser is the largest dependency we have in our web application. We aren't using all of the functionality, notably notifications. Although that feature can be turned off, the code is still included in the bundle. There may be other users that have custom features sets, like those not using the people functionality.

I've seen discussions about potentially making this library more modular. This PR is to help facilitate this through a series of refactors. These are simple mechanical splitting out of mixpanel-core.js into smaller modules, so I've left the commits unsquashed so it's easier to see the refactors one-at-a-time.

The last commit introduces a custom bundle that excludes notifications, saving 44 KB. Our application bundle can use a Webpack alias to swap in that custom bundle.

@tdumitrescu
Copy link
Member

Awesome, thanks so much for doing this! It looks very close to the direction we were planning to take the library already. I can't give a timeline ATM for when we can get to it, but I definitely want to get this patch merged.

@DullReferenceException
Copy link
Author

@tdumitrescu: any update? I've just rebased these changes on master, which required porting changes over to the split files. The longer this sits dormant, the harder it is to keep in sync, so it might be best to merge ASAP so that future changes can go to the split-out modules.

@tdumitrescu
Copy link
Member

Right now we have a couple changesets for new features in development/testing, which have pretty big conflicts with this branch. Once those go out in the coming weeks, I'll make this patch top priority for this lib. Thanks for your patience!

@mikehans9
Copy link

any updates? @tdumitrescu

@tdumitrescu
Copy link
Member

Sorry this never got pushed through. We've now deleted both the notifications module and the autotrack module entirely, so there aren't really any optional modules left in the SDK to worry about.

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.

4 participants