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

Use the SDK with proper "browser" export (+ FRONT-1767) #1981

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mondoreale
Copy link
Collaborator

⚠️ Let's decide when/do we want it in. Maybe a staging release first?


In this PR I update the SDK to the recent "rc" version.

Here's the PR for the SDK internal release (v102.2.0-rc.0 at the time of creating *this* PR).
streamr-dev/network#3019

  • It comes with a proper "browser" export which to no surprise helps making Hub's bundle smaller (and any other bundle I've seen it used on in our workspace).
  • It casts more light at what's in the box (see screenshots for comparison).

Uncompressed size before

  • 5,4M main (Hub's own code) – green
  • 65M vendors (includes the SDK) – blue
image

Uncompressed size after

  • 5.4M main
  • 60M vendors
image

Around 5MB difference! The bundle size is quite a chunk in general and there's plenty of room for improvement but that's a topic for another session.

Copy link

linear bot commented Feb 27, 2025

@mondoreale
Copy link
Collaborator Author

mondoreale commented Feb 27, 2025

More magic ✨ around the browser export:

  • js-dom (Hub's jest environment) mimics the browser thus it doesn't provide fs, crypto, etc.
  • And yet, jest doesn't respect any form of a "browser" export (no "browser" field, no exports.*.browser). So node exports only (main or module).

Copy link
Contributor

@tumppi tumppi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! It's a good question when should we deploy this one 🤔 We could use staging but there's probably not much use on that to spot errors. Maybe we can YOLO to production and revert if there are issues?

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

Successfully merging this pull request may close these issues.

2 participants