dethcrypto / TypeChain

🔌 TypeScript bindings for Ethereum smart contracts
MIT License
2.76k stars 361 forks source link

Consider using ethers sub-packages to reduce bundle sizes #771

Open smartcontracts opened 2 years ago

smartcontracts commented 2 years ago

Hi! Optimism is in the process of trying to reduce bundle sizes for down-stream users of our contract packages. TypeChain currently imports ethers in its entirety into typing files but could instead import specific sub-packages. For example, contract type files import the following:

import type { Listener } from "@ethersproject/providers";
import type { Event, EventFilter } from "ethers";

This can be replaced with

import type { Listener } from "@ethersproject/providers";
import type { Event, EventFilter } from "@ethersproject/contracts";
iainnash commented 2 years ago

+1, I've run into issues with bundle size and conflicting ethers packages. This would at least prevent the number of packages that need to be cross-installed.

asooge commented 2 years ago

+1 this would be a nice improvement to remove "ethers" dependency

zemse commented 1 year ago

Few things that may help with reducing bundle sizes further: