-
-
Notifications
You must be signed in to change notification settings - Fork 3
Description
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.