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

Improve devex when using @waku/core without @waku/create #1159

Open
fryorcraken opened this issue Feb 9, 2023 · 1 comment
Open

Improve devex when using @waku/core without @waku/create #1159

fryorcraken opened this issue Feb 9, 2023 · 1 comment

Comments

@fryorcraken
Copy link
Collaborator

fryorcraken commented Feb 9, 2023

This is a change request

Problem

@waku/create was created as a way to provide good easy default for new users of Waku.
A developer wanting to use js-waku can start with @waku/create to get an app running fast.

However, when it comes to bundle size and dependency optimisation, one may not want to rely on the good default of @waku/create and add few lines of code to end up with a smaller package.

This is what the store-js example https://github.com/waku-org/js-waku-examples/blob/master/examples/store-js/index.html attempt to demonstrate, by initializing a Waku with, and only with, the store protocol.

However, it currently rely on @waku/create to initiate libp2p with good defaults:

https://github.com/waku-org/js-waku-examples/blob/671767400a64de886f47d90162ecb937dbe7f21b/examples/store-js/index.html#L17

If you check the network tab of your browser going to https://examples.waku.org/store-js you'll notice the following index.js files being downloaded:

  • @waku/create: 2.77 MB
  • @waku/core: 1.27MB

Enabling a developer to not use core would be a great gain (do not this include libp2p so the gain may mainly due to not downloading other deps).

Proposed Solutions

Ideally, a user should be able to only depend on @waku/core and libp2p to build the js-store example with a bootstrap peer discovery mechanism.

Not sure if the libp2p setup should be left to the developer (very verbose) or segregated within or outside the @waku/create package.

Out of Scope

Optimising of bundle and size tracked with #579.

@fryorcraken fryorcraken added this to Waku Feb 9, 2023
@fryorcraken fryorcraken moved this to Triage in Waku Feb 22, 2023
@fryorcraken fryorcraken moved this from Triage to To Do in Waku Mar 7, 2023
@fryorcraken
Copy link
Collaborator Author

Note: Maybe this example is not properly setup for the task as no bundler is used.

The point of this issue/example is to prove that @waku/create is a "good defaults" helpers but is not mandatory to use @waku/core when a developer wants to optimize for size and dependencies.

It may be more appropriate to move the store-js example to a package manager + bundler project form and review the bundle output and size once done.

Then, further decisions can be made to improve the @waku/create API.

@fryorcraken fryorcraken added the API label Apr 6, 2023
@fryorcraken fryorcraken moved this from To Do to Priority in Waku May 18, 2023
@fryorcraken fryorcraken moved this from Priority to To Do in Waku May 18, 2023
@fryorcraken fryorcraken removed the API label Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To Do
Development

No branches or pull requests

1 participant