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

reduce bundle size #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

richex-cn
Copy link

@richex-cn richex-cn commented May 22, 2022

I noticed the import of the whole package json:

https://github.com/SergioCrisostomo/v-click-outside-x/blob/master/src/v-click-outside-x.js#L1

This adds an extra 4187 bytes to the bundle and makes no sense:

https://github.com/SergioCrisostomo/v-click-outside-x/blob/master/dist/v-click-outside-x.js#L159

The following is the comparison of bundle size before and after modification:

filename before (bytes) after (bytes) reduce ratio
v-click-outside-x.esm.js 7,637 7,618 99.8%
v-click-outside-x.js 17,504 13,573 77.5%
v-click-outside-x.min.js 7,780 4,253 54.7%

The size of min.js has been reduced by half. Although ESM doesn't see much change here, But it will increases the size of projects that reference the library.

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.

1 participant