surf icon indicating copy to clipboard operation
surf copied to clipboard

Reduce Bundle Size: Make `initia.js` a peer dependency (like `@aptos-labs/ts-sdk`)

Open itsmnthn opened this issue 8 months ago • 1 comments

The surf package bundle size has increased significantly due to initia.js being included as a direct dependency.

This contrasts with @aptos-labs/ts-sdk, which is correctly listed as a peer dependency. For users only needing Aptos support, the bundled initia.js adds unnecessary bloat.

Could initia.js also be changed to a peer dependency? This would align the handling of chain-specific SDKs and allow consumers to only install/bundle initia.js if they actually need Initia functionality, keeping the core package lean for single chain users.

itsmnthn avatar Apr 19 '25 14:04 itsmnthn

@itsmnthn honestly, I don't think simply make it as peer dependency can resolve this issue. Because initia is used in the function like "view". Even if I make it peer dependency, if the user doesn't install "initia.js", there would be some build error.

To resolve this, we need to export a different folder:

  • A folder with functions for aptos only, no initia dependency.
  • A folder with functions for both aptos and initia.

But I don't have much time to work on this recently. Feel free to contribute if anyone is interested; it shouldn't be too complex.

SamuelQZQ avatar Apr 29 '25 02:04 SamuelQZQ