feross / feross/simple-peer

Thoughts on reducing browser bundle size

Open
#280 22 comments 4 reactions 0 assignees View on GitHub
feature request
Dominant language
JavaScript
Stars
7.8k
Forks
983
PR merge metrics
No merged PRs in 30d

Description

In my current app `simple-peer` is about 10% of an application size and about 20% of JS code size.
Specifically, while `index.js` is 29.5KiB and one might expect that minified version would be even smaller, `simplepeer.min.js` is whopping 86.5KiB right now.

Before I create and start maintaining a fork of this project, I'd like to know if if this is something that can be fixed upstream.

2 packages that cause this huge size:
* `readable-stream`
* `buffer`

`readable-stream` is valuable in Node.js, but not so much in browser environment. Is it possible that future versions of `simple-peer` will stop using it entirely and replace with something lightweight instead? I imagine it wouldn't be too hard to implement a wrapper or even offer an optional one with this library.

`buffer` is a simpler one, once `readable-stream` is eliminated we'll just need to switch from `Buffer` to `Uint8Array`, which is quite easy to do.

Current bundle size doesn't seem tolerable to me given that it is just a wrapper around native features, so I hope for your understanding here. If these changes seem reasonable, I'd be happy to implement them myself, otherwise I'll be forced to create something like `simple-peer-light` and just maintain that fork forever.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.