cosmjs icon indicating copy to clipboard operation
cosmjs copied to clipboard

transpile with tsdown instead of tsc

Open dynst opened this issue 3 months ago • 0 comments

Lays the necessary groundwork for #1804

dist/ is the default output directory. https://tsdown.dev/options/output-directory

debugging (Possibly blocked on #1816 to drop a use of `node:crypto` https://github.com/paulmillr/noble-hashes/commit/c7ad2078c1bfb302034d49390c8dd4e2a2a3417b) Or not. Found a workaround.

yarn pack-web was failing in the stargate package because:

  • @cosmjs/crypto was being bundled into the build/ directory, along with all its dependencies recursively;
  • This was because it exists in "devDependencies" and not in "dependencies";
  • This would be harmless (webpack is about to bundle all code+dependencies into 1 file anyway), but one of the recursive dependencies, @noble/hashes, has a particular file that varies in its resolution depending on the environment being node or not-node;
  • This was being resolved at bundling-time, copying node-specific code (cryptoNode.js) into build/;
  • Resolution should instead be deferred to when webpack runs, where it will resolve to the not-node code (crypto.js).
  • So an explicit --external=@cosmjs/crypto was needed.

dynst avatar Oct 08 '25 20:10 dynst