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? #295

Closed
te-online opened this issue Jun 25, 2021 · 6 comments
Closed

Reduce bundle size? #295

te-online opened this issue Jun 25, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@te-online
Copy link

te-online commented Jun 25, 2021

I'm excited to move away from window.OC to the @ nextcloud packages in most cases and I recently added @nextcloud/auth to one of my Nextcloud apps. 🤓 This package, in turn, requires @nextcloud/nextcloud-bus, which unfortunately, seems to have had a considerable effect on bundle size. Right now, it's 13.41 % of the whole app's bundle.

/node_modules/@nextcloud/event-bus/dist/index.es.js
██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 13.41 % (113.459 KB)

I quickly looked through this repository and I can't see any apparent reason why the code transpiles to more than 100 KB, maybe it is the import of semver? Or maybe it is simply legacy browser-support? Any ideas on how to reduce the size? 😊

@ChristophWurst
Copy link
Contributor

That's something to analyze indeed. The package code itself is minimal, I can also only imagine it's one of the deps or the transpilation process.

@ChristophWurst ChristophWurst added the bug Something isn't working label Jun 28, 2021
@te-online
Copy link
Author

Using a different module to replace the functionality provided by semver could be a possible solution.

Something like this?

https://www.npmjs.com/package/semver-regex

I can see that some refactoring would be needed, though, so I'm a bit hesitant... 😩

@te-online
Copy link
Author

I'm going to leave it at that for now. 🤓 Even though improving speed and reducing bundle-size is an important issue, I have to admit that I won't be able to pick up the refactoring work needed. Sorry!

@juliusknorr
Copy link
Contributor

Should be fixed by #481 now, right @vinicius73 ?

@vinicius73
Copy link
Contributor

Yes @juliushaertl, we are waiting #490 to be merged to close this issue.
It is one of other steps we are thinking to improve all or packages ecosystem.

@vinicius73
Copy link
Contributor

New version published
https://bundlephobia.com/package/@nextcloud/[email protected]

The v3 is ~60% smaller than previous version.

We will release new versions of @nextcloud/axios and @nextcloud/auth soon as possible.

nextcloud-libraries/nextcloud-axios#438
nextcloud-libraries/nextcloud-auth#408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants