Skip to content

Conversation

@0xethll
Copy link

@0xethll 0xethll commented Oct 22, 2025

Summary

Migrate from CommonJS dependencies (fetch-retry, keccak) to pure ESM alternatives (ky, ethers built-in crypto) to improve compatibility with modern bundlers like Vite.

Problem

When using @zama-fhe/relayer-sdk in Vite projects, the package must be excluded from pre-bundling (optimizeDeps.exclude) because it contains CASM files. However, this causes Vite to fail when processing CommonJS dependencies within the excluded package.

Solution

  • Replace fetch-retry with ky (pure ESM HTTP client with retry support)
  • Replace keccak package with ethers' built-in keccak256, concat, and getBytes functions

Benefits

  • ✅ Better Vite compatibility
  • ✅ Eliminates CommonJS dependencies for improved tree-shaking
  • ✅ Reduces package count (removes keccak, @types/keccak, fetch-retry)

@cla-bot cla-bot bot added the cla-signed label Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant