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

web3.js: add sideEffects: false to package.json #27885

Closed

Conversation

macalinao
Copy link
Contributor

Problem

Adds sideEffects: false to help bundlers tree shake.

@mergify mergify bot added the community Community contribution label Sep 17, 2022
@mergify mergify bot requested a review from a team September 17, 2022 23:51
@steveluscher
Copy link
Contributor

I would love to be able to do this as part of solana-labs/solana-web3.js#1122, but unfortunately this is not true. We actually do produce side effects on import.

Merely importing PublicKey registers a schema in the global scope.

SOLANA_SCHEMA.set(PublicKey, {
kind: 'struct',
fields: [['_bn', 'u256']],
});

There's a way around this, but it will involve creating new package boundaries – ie. spinning out the side-effectful parts of web3.js into their own packages – but I'm not sure that's worth the lift when I could spend the time on solana-labs/solana-web3.js#1111.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants