-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
fix: reduce bundle size #172
Conversation
@merceyz Thanks for your help! I have one question tho, does it need |
Yes it does, they're no longer bundled by rollup which means we need to declare them. |
Ping @iamstevendao |
@merceyz @tatthien Sorry, I'm no expert in this bundling process so I hesitate to merge your PR. I followed the configuration of Akryum in https://github.com/Akryum/v-tooltip, not sure if I missed something, what do you think? |
That's fine, neither am I but I'll try to explain.
That project also bundles If you look at https://github.com/Akryum/v-tooltip/blob/782c86f81d529a705bf566825457cf97748ca0b8/dist/v-tooltip.esm.js#L69-L87 and https://github.com/EducationLink/vue-tel-input/blob/50398393251bd7b9a5a3284eb2dfe733c7958971/dist/vue-tel-input.esm.js#L3379 You'll see that they are more or less identical, so including them multiple times is a waste of space. The changes in this PR makes it add an import to It does the same for
If you build with this PR locally you'll see it now imports code from |
So |
@merceyz Thanks for your help! Let me do some research on this and get back to you. |
Thank you @merceyz. Indeed the build is too large (>400 kB). I was thinking about reducing bundle size by removing list of countries in case we have already one internally that is compatible with the component. This can avoid loading it twice... Hello @iamstevendao, any feedback to provide us ? Thanks |
It's easier for |
I did some test with the new reduced build. No issue on my side. 👍 |
Thanks guys, it's now on |
Nice! |
I am looking at For example, |
Here is an example of a bundle that we get right now for phone number entry: The combined gzipped size is 111.53KB. There are also 33KB of gzipped If |
What's the problem this PR addresses?
vue-tel-input
is bundling its dependencies. Specificallycore-js
and@babel/runtime
which causes a lot of duplicated code in applicationsHow did you fix it?
Updated the
@vue
dependencies to get an up-to-date babel preset and stopped resolving dependencies for theesm
buildSizes
All results are minimized with terser, in my application these changes reduced my bundle size by 51.2kB.