# Runtime Error: `(0 , superstruct_1.boolean) is not a function` in browser environment
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- react, typescript
Hướng nghiên cứu
Tái hiện lỗi bằng một Create React App sử dụng CRACO và dependency @openzeppelin/merkle-tree được liệt kê. Bắt đầu bằng cách kiểm tra @metamask/abi-utils/dist/parsers/bool.js và phần xử lý superstruct.boolean trong bundle. Được xem là hoàn tất khi ứng dụng trên trình duyệt tải mà không gặp runtime error này và các ABI utilities bị ảnh hưởng vẫn có thể sử dụng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Create a new React application using Create React App
- Install CRACO:
yarn add @craco/craco - 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 - Add basic CRACO configuration for webpack
- Start the development server:
yarn start - 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
- Added webpack configuration to handle ESM/CommonJS conversion
- Cleared node_modules and yarn cache
- 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
- Is there a recommended way to use
@metamask/abi-utilsin a browser environment? - Are there specific webpack/bundler configurations that should be used?
- Is this a known issue with the package's browser compatibility?
Thank you for your help in resolving this issue.
- Ngôn ngữ chính
- TypeScript
- Star
- 24
- Fork
- 8
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MetaMask/abi-utils
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
enhancement help wanted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Tất cả issue của MetaMask/abi-utils
Issue tương tự
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
inu-appcenter/memorIN-frontend#106 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
kind/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 7 ngày
-
[Bug] @deck.gl/arcgis dist import resolves to unpublished @deck.gl/core source path (9.3.11, 9.4.0)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
fix: CopyFilters ignores tabĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
CSCfi/sd-search-ui#145 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: Cbeebies pl SDĐang mởcheck:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày