TypeChain
TypeChain copied to clipboard
Slim down the library size
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:
-
prettieris 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 -
lodashis 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
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.