question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reduce the library size

See original GitHub issue

Is 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:

ethers-bundle-analyze

& this is from browser if full lib is loaded:

ethers-size

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:open
  • Created 2 years ago
  • Reactions:7
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ricmoocommented, Oct 23, 2021

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.

2reactions
ricmoocommented, Oct 22, 2021

@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; the abi indicates it is in the @ethersproject/abi package.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found