Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ESM import of @metamask/eth-sig-util in @trezor/connect-plugin-ethereum #16245

Open
superKalo opened this issue Jan 7, 2025 · 0 comments
Labels
bug Something isn't working as expected connect Connect API related (ie. fee calculation)

Comments

@superKalo
Copy link
Contributor

superKalo commented Jan 7, 2025

In a Manifest V3 environment (browser extension), @metamask/eth-sig-util v7 (and probably v8) (ESM-only), a dep of @trezor/connect-plugin-ethereum, causes runtime errors because @trezor/connect-plugin-ethereum (as of v9.0.5) compiles to CommonJS and does:

const sigUtil = tslib_1.__importStar(require('@metamask/eth-sig-util'));

This crashes in MV3 service workers because the lib no longer provides a CJS build. Steps to Reproduce:

  1. Use @trezor/connect-plugin-ethereum in a Manifest V3 extension.
  2. Bundle with Webpack or similar.
  3. Observe that the background service worker crashes at runtime due to the ESM/CJS mismatch.

Why It Happens:

  • @metamask/eth-sig-util v7 is ESM-only.
  • tslib.__importStar(require(...)) is effectively a CommonJS import.
  • Manifest V3 service workers require the library to be bundled or imported as ESM.

Please provide an ESM-compatible version of @trezor/connect-plugin-ethereum that imports @metamask/eth-sig-util using native ESM. This would probably resolve the MV3 service worker crash 🙏

@superKalo superKalo added bug Something isn't working as expected connect Connect API related (ie. fee calculation) labels Jan 7, 2025
@github-project-automation github-project-automation bot moved this to 🎯 To do in Issues Suite Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected connect Connect API related (ie. fee calculation)
Projects
Status: 🎯 To do
Development

No branches or pull requests

1 participant