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

fix: make web3.js tree shakable by optimizing compilers #25014

Closed
wants to merge 30 commits into from
Closed

fix: make web3.js tree shakable by optimizing compilers #25014

wants to merge 30 commits into from

Conversation

steveluscher
Copy link
Contributor

Problem

There are two main obstacles that an optimizing compiler faces when trying to tree-shake our JavaScript SDK.

  1. We perform a lot of work in our module factories – baking layouts before they're used – and an optimizing compiler can't know for sure that work is side-effect free. The target amount of work to do in module factories is zero.
  2. For all the work we do in module factories that a compiler sees as potentially side-effectful, the libraries that we pull in through npm do even more.

Summary of Changes

Will write an essay here when this PR is ready.

Test Plan

yarn build
npx agadoo lib/index.browser.esm.js

Fixes solana-labs/solana-web3.js#1122.

@stale
Copy link

stale bot commented Jun 12, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Jun 12, 2022
@stale
Copy link

stale bot commented Jul 10, 2022

This stale pull request has been automatically closed. Thank you for your contributions.

@stale
Copy link

stale bot commented Aug 13, 2022

This stale pull request has been automatically closed. Thank you for your contributions.

@stale stale bot closed this Aug 13, 2022
@steveluscher
Copy link
Contributor Author

This is fine. I’m going to get this done in smaller chunks anyway.

@steveluscher steveluscher deleted the shake-my-tree branch December 7, 2022 19:17
@steveluscher steveluscher restored the shake-my-tree branch December 7, 2022 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code stale [bot only] Added to stale content; results in auto-close after a week.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

web3.js: library is not tree-shakeable
1 participant