Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove encoding library bloat in @hamony-js/staking JavaScript SDK #108

Open
klngrs opened this issue Dec 21, 2021 · 1 comment
Open

Remove encoding library bloat in @hamony-js/staking JavaScript SDK #108

klngrs opened this issue Dec 21, 2021 · 1 comment

Comments

@klngrs
Copy link

klngrs commented Dec 21, 2021

When analyzing a recent build, I noticed that @harmony-js/staking is causing my bundle size to blow up due to the use of "text-encoding", which is now a deprecated library.

image

Reference:

import { TextEncoder } from 'text-encoding';

  1. I searched @harmony-js and it appears this library is only used in the staking sdk: https://github.com/harmony-one/sdk/search?q=%22text-encoding%22
  2. It looks like harmony is only using the UTF-8 encoder, since that's the default if no params are passed.
    https://github.com/harmony-one/sdk/blob/master/packages/harmony-staking/src/stakingTransaction.ts#L324

Given the above, I'd like to propose a leaner / tree-shakeable alternative to the deprecated "text-encoding"

@chybisov
Copy link

chybisov commented Feb 9, 2022

Came here to say exactly this. TextEncoder has native support a long time already and text-encoding was deprecated three years ago 😃

40% https://bundlephobia.com/package/@harmony-js/[email protected]

image

@gupadhyaya @Renewwen @denniswon could you please look into this? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants