Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Improve bundle size by 2x #1

Merged
merged 1 commit into from
Sep 13, 2021
Merged

Improve bundle size by 2x #1

merged 1 commit into from
Sep 13, 2021

Conversation

dawsbot
Copy link
Contributor

@dawsbot dawsbot commented Sep 13, 2021

When comparing the size before this PR and after, it went:

Before

size: 87831,
gzip: 24612,

After

size: 42981,
gzip: 13020,

You can see from the original EIP that the keccak library is trusted by the Eth core devs and is a secure package: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md

Here are the bundle size comparisons:

https://bundlephobia.com/package/[email protected]
https://bundlephobia.com/package/[email protected]

Test the size diff yourself

// belongs in the parent directory to "ethereum-checksum-address"
import { getPackageStats } from "package-build-stats";
import path from "path";

(async () => {
  const results = await getPackageStats(
    path.join(__dirname, "ethereum-checksum-address"),
    {}
  );
  console.log({ results });
})();

My VSCode bundle diff

image

(this is made possible with https://github.com/wix/import-cost)

@dawsbot dawsbot changed the title Replace keccak256 with light-weight keccak library Improve bundle size by 2x Sep 13, 2021
@miguelmota
Copy link
Owner

Hey @dawsbot! The PR looks good!

Merging 👍

Btw I'm the author of the package keccak256 which is just a simple wrapper over keccak that also includes a cli, which is the reason for larger size

@miguelmota miguelmota merged commit a807932 into miguelmota:master Sep 13, 2021
@dawsbot dawsbot deleted the trim-bundle-size branch September 14, 2021 00:42
@dawsbot
Copy link
Contributor Author

dawsbot commented Sep 14, 2021

Ooh, @miguelmota that makes sense! I like CLI's too, perhaps you could split them up the way sindresorhus does?

The cli imports the non-cli, so you'll never need meow in the js package 🙌

https://github.com/chalk/chalk-cli
https://github.com/chalk/chalk

@dawsbot
Copy link
Contributor Author

dawsbot commented Sep 14, 2021

We made the world a little better today 👌

Screen Shot 2021-09-13 at 5 44 57 PM

https://bundlephobia.com/package/[email protected]

@miguelmota
Copy link
Owner

@dawsbot yep completely agree! that's the way to go

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

Successfully merging this pull request may close these issues.

2 participants