Reduce the library size
See original GitHub issueIs your feature request related to a problem? Please describe.
It seems with new features size is increasing, Readme file says 322kb
uncompressed but it reality it is 748kb
. which seems large.
For example in Next.js pages with some ethers import & some other basic ui lib page initial load is going above 240Kb
This image is from bundle analyser & total parsed size with ethers related imports is around 177kb
:
& this is from browser if full lib is loaded:
Describe the solution you’d like May be some another lite version for web3 provider. or more modular structure & better way to import specific module from web3 provider in which tree shaking works in better way in all frameworks like Angular, React Or Next.js (with webpack 5).
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:8 (4 by maintainers)
Top Results From Across the Web
c++ reduce library size by excluding unnecessary functions ...
What is the easier way to reduce library size by selecting only needed functions and eliminating unnecessary files ?
Read more >Reduce library size in Final Cut Pro - Apple Community
Start by deleting generated files. That will get you back hundreds of GB. Select the library in the browser sidebar and do File->Delete ......
Read more >How to minimize library size - Arduino Forum
The ArduinoBLE library dramatically increases program size and for OTA purposes I am trying to keep my program as compact as possible.
Read more >Reduce Library Binary Size for AVS Device SDK
Catch the latest on ambient intelligence, smart home, and AI. You can use the following methods to reduce the size of the libraries...
Read more >minimizing fcpx library file size - FCP.co Forum
I seem to remember being able to delete rendered files or other files that would help reduce the overall file size? This wouldn't...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No part of ethers depends on Web3.js. The Web3Provider knows how to interact with a Web3.js provider, as well as EIP-1193 providers. But there is no dependency.
Web3.js depends on does depend on ether though, for the ABI coder.
The main thing the breaks tree-shaking is the way TypeScript handles static class method, which I’ve redesigned a bit in v6. Different tree shakers behave better than others too, which is why v6 makes extensive use of splitting functionality across separate files which helps tree shakers too.
@wmitsuda Yes, that is the ideal way for v5 if you only need a handful of functions. I don’t have a super easy way to identify which package to pull from (I should add that to the docs, and do have a task for it, I just haven’t had time), but one easy method is to look up the function in the docs and click the “source” link, which will take you to that functions source code on GitHub, from which the path will look like
packages/abi/src.ts/index.ts
; theabi
indicates it is in the@ethersproject/abi
package.