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

@safe-apps-sdk - bundle size - consider importing semverGte directly, or remove semver altogether #154

Closed
brendanmc6 opened this issue May 8, 2021 · 1 comment

Comments

@brendanmc6
Copy link

brendanmc6 commented May 8, 2021

Semver makes up 58% of this javascript bundle, according to bundlephobia.

Semver is only used on one line:
https://github.com/gnosis/safe-apps-sdk/blob/9568ed238b584251ac9ee5e21c5cbbaf1693fc9f/packages/safe-apps-sdk/src/communication/index.ts

Consider importing the function directly for better code-splitting (this probably won't reduce the predicted size on bundlephobia, but may reduce final bundle size for projects with tree-shaking)

const semverGte = require('semver/functions/gte')

Or even better, compare version by hand and remove semver from package.json :)

Not sure if this is high-prio as it's possible the above file is already tree-shaken in most projects, I haven't looked where that file is actually used

@brendanmc6 brendanmc6 changed the title Bundle Size: consider importing semverGte directly, or remove semver altogether @safe-apps-sdk - bundle size - consider importing semverGte directly, or remove semver altogether May 8, 2021
@mmv08
Copy link
Member

mmv08 commented May 27, 2021

@mmv08 mmv08 closed this as completed May 27, 2021
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

No branches or pull requests

2 participants