Skip to content

hash.js import issue with ESM: “does not provide an export named 'sha256'” #99

Description

@bilou42

Currently WharfKit packages (for example @wharfkit/session) assume a Node or bundler environment such as Vite or Webpack. When attempting to load them directly in the browser as ESM modules via a CDN like jsDelivr, the imports fail due to internal CommonJS dependencies such as hash.js.

Example:
import SessionKit from 'https://cdn.jsdelivr.net/npm/@wharfkit/session@1.6.1/+esm'

Error shown in console:
Uncaught SyntaxError: The requested module '/npm/hash.js@1.1.7/+esm' does not provide an export named 'sha256'

This happens because hash.js is CommonJS-only, but WharfKit’s generated ESM build expects named exports from it.

For lightweight dApps or static sites, it would be very useful to load WharfKit modules directly from a CDN without needing a bundler or build step — similar to how Anchor-Link supported pure browser ESM usage.

I understand WharfKit is designed for modern JS app environments, but adding browser-compatible builds would make it much easier to integrate with small web projects or simple dApp frontends that don’t use build tooling.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

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