web3js-quorum icon indicating copy to clipboard operation
web3js-quorum copied to clipboard

Large bundle size

Open mfolnovic opened this issue 3 years ago • 2 comments

Having import Web3Quorum from "web3js-quorum"; increases bundle size by a lot.

In my project, before importing it, bundle size was 396.68 KiB / gzip: 115.09 KiB. After importing it, bundle size increased to 1649.67 KiB / gzip: 472.42 KiB.

System information

Client type: Besu Bundler: Rollup

Expected behaviour

Bundle size shouldn't increase that much.

Actual behaviour

Bundle size increases by ~1.2MB uncompressed.

Steps to reproduce the behaviour

In any example project, try building it with and without importing web3-quorum.

mfolnovic avatar May 08 '22 17:05 mfolnovic

I assume the issue is that you are publishing raw source, instead of bundling it (cjs/umd/esm)?

If that's true, I guess this is also why I'm having issues with using web3js-quorum after bundling everything:

Uncaught TypeError: Object prototype may only be an Object or null: undefined
    at Function.create (<anonymous>)
    at privateSubscription.js:234:40
    at index.fed4010a.js:1:637
    at main.tsx:10:1

image

mfolnovic avatar May 08 '22 17:05 mfolnovic

I've managed to make it work by adding build step in web3js-quorum and using bundled library.

Would you be interested in PR that adds this, modeled on how web3.js does it: https://github.com/ChainSafe/web3.js/blob/1.x/webpack.config.js ?

mfolnovic avatar May 10 '22 07:05 mfolnovic