TypeChain icon indicating copy to clipboard operation
TypeChain copied to clipboard

Slim down the library size

Open mcmxcdev opened this issue 3 years ago • 1 comments

According to https://bundlephobia.com/package/[email protected], this lib is 558kb big (minified), which is not acceptable for consumers who want to offer a fast web experience. Additionally, not every user has an infinite amount of bandwidth available to download excessive data.

There are two dependencies that seem to cause most of the bundle size bloat:

  • prettier is bundled as prod dep, is there a chance to make it optional or put it into devDeps? I found this related issue: https://github.com/dethcrypto/TypeChain/issues/570
  • lodash is easy to use but makes up 20% of the bundle size of this lib, most of the methods can be easily replaced with native JS, e.g. https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_flatten

mcmxcdev avatar May 11 '22 11:05 mcmxcdev

consumers who want to offer a fast web experience

Can you mention how are you using the typechain in a web page? If you are generating types, typechain is not needed to be present in the bundle, it can be just a dev dependency.

zemse avatar May 14 '22 12:05 zemse