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
Dependency hygiene #1687
Comments
One nice side effect of this effort. So far I've been able to reduce the bundle size by 10KB! From 98338 bytes to 88915 bytes, so far. Should get quite a bit smaller once browserify/browserify#1916 is merged. |
Is it worth all the effort put it on this to just reduce the bundle by 10kb? Just asking because my lack of knowledge. |
Depends on your priorities. Small size has always been one of my priorities with WebTorrent. It's one of the best parts of WebTorrent – that it's small and carefully selects dependencies. Lots of others decentralized web projects require 2MB+ of JavaScript and don't work nearly as well as WebTorrent does. The fact that we can fit a whole torrent client into <100KB is amazing. Also, updating dependencies gives us bug fixes, wards off potential security issues, and makes installation faster. |
I recommend using pnpm as the package manager, as it avoids “phantom dependency” and “npm doppelganger” problems by using symlinks, hardlinks and isolated trees. “npm doppelgangers” in particular are a common‑ish cause of exploding bundle sizes. |
This is a valid issue that can sometimes happen but I'll be adding a rule to
This is not a problem with |
I went hard with v2's dependency pruning, and once this or this happens we'll be down to 206KB from v1's 875KB which is a 75% reduction in bundle size, which is still a lot more than v0's <100KB, but the feature difference is immense from looking at the dependency tree there isn't much more to prune, most of the biggest modules come from webtorrent's ecosystem itself, or from it's maintainers, in filesize order:
once either of the above issues are fixed, we'll have dropped stream and all its sub dependencies, all stream utility modules, buffer and it's dependencies, there isnt much more tbh |
I want to go through the whole
webtorrent
dependency tree to:This issue is a placeholder to track this task.
I'm tracking progress on this work in this issue: brave/brave-browser#5490
The text was updated successfully, but these errors were encountered: