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

Add browser docs #3329

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions config/BROWSER.md
@@ -0,0 +1,17 @@
# Building for the browser

One of the goals of our libraries is to be fully browser compatible. We have examples using the [`vite`](https://vitejs.dev/) framework in each of the libraries that can be referenced as a jumping off point.

## Projects that use EthereumJS libraries in the browser

Here are some projects that use our libraries in browser to give you some inspiration. These are not guaranteed to be 100% up to date but give you some examples of projects that use our code.

- [TEVM](https://github.com/evmts/tevm-monorepo) - a JavaScript EVM client and a Solidity-to-TypeScript compiler
Copy link
Collaborator

Choose a reason for hiding this comment

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

❤️

- [Remix](https://remix.ethereum.org/) - a browser based Soldity compiler
- [Blobs4Every1](https://github.com/acolytec3/blobs4every1) - a simple Vite + React web app that can generate Blob EIP 4844 Transactions and submit them to the Holesky chain

## Potential Gotchas

Some of our libraries use Javascript APIs where the NodeJS and browser versions are not 100% equivalent. In these cases, these APIs need to be polyfilled when building for the browser. Below are known potential browser incompatibilities and polyfills that are known to work in browser. Please refer to your particular bundler/framework on guidance for how to leverage these polyfills in your application.

- `events` - [`eventemitter3`](https://www.npmjs.com/package/eventemitter3) - Our usage of the native NodeJS `eventemitter` class apparently onflicts with the typing of the browser equivalent `eventemitter` and polyfilling with `eventemitter3` is known to resolve this
Copy link
Member

Choose a reason for hiding this comment

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

Now that we are in discussion of also eliminate this major remaining gotcha, I wonder if there is enough substance left in the whole browser section to justify a separte document. 🤔

Basically only the examples left to stay for now.

Totally not against adding example projects, but maybe in this case we can move TEVM and Remix to the EVM, I would suggest a new section "External Projects" or "Using Projects" or similar in between here:

grafik

And Blobs4Every1 can go into the 4844 tx section of the tx library?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with this approach, provided we can make #3330 work. Will leave this PR here for the moment until #3330 is closed or merged.