arj03 / ssb-browser-demo

A secure scuttlebutt client interface running in the browser
Other
58 stars 11 forks source link

Shrink main dist file #219

Closed KyleMaas closed 3 years ago

KyleMaas commented 3 years ago

Main dist file is currently about 6.9MB (see https://github.com/arj03/ssb-browser-demo/pull/208#issuecomment-776765786). Let's see if we can shrink that.

KyleMaas commented 3 years ago

@arj03 Not finding a whole lot more opportunities to shrink this. With #221 merged in, do you think we could close this?

arj03 commented 3 years ago

I have a tool I'd like to use to figure out what is taking this space. So lets keep it open for now.

KyleMaas commented 3 years ago

This would help a little:

https://github.com/dweinstein/pull-async-filter/issues/1

arj03 commented 3 years ago

Now I remember the tool: npm i -g disc

discify dist/js/bundle-ui.js > out.html

image

Some of the biggest:

Toast: 1.2mb Highlight: 1mb libsodium: 500kb codemirror: 400kb

It should be possible to disable highlight somehow I think. The gain we get from that package seems rather minimal.

arj03 commented 3 years ago

Yeah highlight.js comes from ssb-markdown. Maybe add a switch so it can be disabled?

arj03 commented 3 years ago

Bip39 is 200kb. Wonder where that is used.

KyleMaas commented 3 years ago

I checked on Bip39 before. It's used for mnemonic keys.

KyleMaas commented 3 years ago

That's part of where I focused my efforts for minifying before, because I noticed the mnemonic key word lists have a ton of whitespace in them. Part of the reason I've been working on shrinking the release bundle rather than the build bundle.

KyleMaas commented 3 years ago

Well, that takes us down to about 3.5MB. Do you think that's good enough, or is there more you'd like to try to do?

arj03 commented 3 years ago

I'll close this now. 1mb off compared to last release is pretty good. Thanks for the help with this @KyleMaas :)

KyleMaas commented 3 years ago

You're welcome!