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

Prevent socket.io-client duplication by force user to provide an instance of it #19

Closed
probil opened this issue Apr 2, 2018 · 0 comments
Assignees
Labels
enhancement 🚀 New feature or request good first issue ✋ Good for newcomers
Milestone

Comments

@probil
Copy link
Owner

probil commented Apr 2, 2018

I've made investigation today using vue cli, and that's what I got:

vue                                                    : 61.77 kb
vue + vue-socket.io-extended                           : 132.10 kb
vue + vue-socket.io-extended + custom socket.io-client : 190.87 kb

There is a duplication of socket.io-client library when you pass socket.io-client instance to the plugin.
So if you use it this way, you probably have extra ~70kb of useless data in your build.

The only way to fix it is to force library user to pass socket.io-client instance always.

Advantages:

  • less build size with custom socket.io-client (e.g. ~70Kb)
  • no force version of socket.io-client for user
  • no need to support socket.io-client inside the library (update library just because socket.io-client updated)
  • user can pass any library compatible with socket.io-client, for example, socket.io-client/dist/socket.io.slim.js which is ~8kb smaller than socket.io-client but drops IE6-8

Disadvantages:

  • little harder to setup
@probil probil added the enhancement 🚀 New feature or request label Apr 3, 2018
@probil probil added this to the 2.0.0 milestone Apr 3, 2018
@probil probil self-assigned this Apr 3, 2018
@probil probil added the good first issue ✋ Good for newcomers label Apr 3, 2018
@probil probil closed this as completed Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🚀 New feature or request good first issue ✋ Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant