Skip to content

Bundles are big #904

Closed
Closed
@elsehow

Description

I've been finding that bundles with cosmjs tend to be pretty big (600k+), much of which appears to be due to the dependency on libsodium.

Here's an example from a recent (next.js) build:

Screen_Shot_2021-10-18_at_9 17 42_AM

yarn why libsodium
yarn why v1.22.17
[1/4] Why do we have the module "libsodium"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "libsodium@0.7.9"
info Reasons this module exists
   - "@cosmjs#cosmwasm-stargate#@cosmjs#crypto#libsodium-wrappers" depends on it
   - Hoisted from "@cosmjs#cosmwasm-stargate#@cosmjs#crypto#libsodium-wrappers#libsodium"
info Disk size without dependencies: "508KB"
info Disk size with unique dependencies: "508KB"
info Disk size with transitive dependencies: "508KB"
info Number of shared dependencies: 0
Done in 0.52s.

It seems cosmjs's dependency on libsodium comes from this import.

I wonder: is it possible to optimize our use of libsodium to minimize its footprint, or at least make it more amenable to optimization by static analyzers?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions