Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

# Runtime Error: `(0 , superstruct_1.boolean) is not a function` in browser environment

オープン
#95 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
react, typescript
領域
frontend, web-dev

調査の方向性

CRACO と記載されている @openzeppelin/merkle-tree 依存関係を使用する Create React App で障害を再現します。まず @metamask/abi-utils/dist/parsers/bool.js と、バンドルに含まれる superstruct.boolean の処理を調査します。ブラウザーアプリケーションがこのランタイムエラーなしで読み込まれ、影響を受けた ABI utilities が引き続き使用できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Following up on this issue https://github.com/ethereum-attestation-service/eas-sdk/issues/125

When using @metamask/abi-utils in a React application (Create React App with CRACO), we encounter a runtime error related the superstruct's boolean function.

Error Details Browser console error:

bundle.js:3328 Uncaught TypeError: (0 , superstruct_1.boolean) is not a function
    at ./node_modules/@metamask/abi-utils/dist/parsers/bool.js (bundle.js:3328:76)
    at options.factory (bundle.js:167452:30)
    at __webpack_require__ (bundle.js:166819:32)
    at fn (bundle.js:167080:21)
    at hotRequire (bundle.js:167435:47)
    at ./node_modules/@metamask/abi-utils/dist/parsers/index.js (bundle.js:3752:14)
    at options.factory (bundle.js:167452:30)
    at __webpack_require__ (bundle.js:166819:32)
    at fn (bundle.js:167080:21)
    at hotRequire (bundle.js:167435:47)

Steps to Reproduce

  1. Create a new React application using Create React App
  2. Install CRACO: yarn add @craco/craco
  3. Install @openzeppelin/merkle-tree (or @ethereum-attestation-service/[email protected] as per this issue https://github.com/ethereum-attestation-service/eas-sdk/issues/125) which depends on @metamask/abi-utils
  4. Add basic CRACO configuration for webpack
  5. Start the development server: yarn start
  6. The error appears in the browser console immediately upon loading

Environment

  • React version: 18.3.1
  • Node.js version: 20.18
  • Yarn version: 1.22.17
  • Create React App with CRACO

Dependencies

{
  "dependencies": {
    "@openzeppelin/merkle-tree": "^1.0.8"
  }
}

Attempted Solutions

  1. Added webpack configuration to handle ESM/CommonJS conversion
  2. Cleared node_modules and yarn cache
  3. Added specific babel-loader configuration for MetaMask packages

Additional Context

The error occurs specifically in the browser environment and seems to be related to how the superstruct exports are being handled during bundling. The issue appears to be a module resolution problem where the boolean function from is not being properly imported/exported.

Questions

  1. Is there a recommended way to use @metamask/abi-utils in a browser environment?
  2. Are there specific webpack/bundler configurations that should be used?
  3. Is this a known issue with the package's browser compatibility?

Thank you for your help in resolving this issue.

主要言語
TypeScript
スター
24
フォーク
8
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MetaMask/abi-utils のほかの issue

MetaMask/abi-utils の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。