Skip to content

Using std package without exports for target=wasm32 #1962

Closed
@kromsten

Description

@kromsten

When a project references cosmwasm_std crate as one of the dependencies and is being compiled to wasm32 architecture, the package injects entrypoint exports into the final wasm build

#[cfg(target_arch = "wasm32")]
pub use crate::exports::{do_execute, do_instantiate, do_migrate, do_query, do_reply, do_sudo};

It might not be desirable when developing interfaces and libraries that only need certain types like Binary, Uint128and so on.

It unnecessarily increases the size when building for Javascript environment and causes issues when building for virtual machines with custom constraints

A possible solution would be to only inject the exports when referencing cosmwasm contract specific entities like entrypoint or to provide additional feature flag for the crate (e.g. library) for opting out of injection

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions