Dynamic `import()` of a Node-API addon doesn't work on Android
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
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- android, babel, react-native, typescript
- Lĩnh vực
- build-system, mobile
Hướng nghiên cứu
Bắt đầu với TODO trong apps/test-app/App.tsx và tái hiện lỗi import động trên Android, ghi lại xem nó bị reject hay throw và thông báo của nó. Sau đó, kiểm tra packages/host/src/node/babel-plugin/plugin.ts để so sánh cách xử lý require() và import(). Hoàn thành có nghĩa là import động hoạt động trên Android, hoặc giới hạn và nguyên nhân của nó được ghi lại, bao gồm giải thích có ý nghĩa cho eslint-disable.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Tracking the TODO in apps/test-app/App.tsx.
The ferric-example test has to use require() — with an ESLint disable for @typescript-eslint/no-require-imports — because a dynamic import() of the same addon does not work on Android:
Nobody has established why. It matters beyond the test app: consumers writing modern ESM will reach for await import("some-addon") first, and if that silently fails on Android while working on iOS, it is a confusing first-run experience for exactly the audience this project targets.
Worth checking, roughly in order of likelihood:
- Whether the Babel plugin in
packages/host/src/node/babel-plugin/plugin.tsrewritesrequire("./addon.node")but leavesimport("./addon.node")untransformed — the plugin matchesrequirecall expressions, so a dynamic import may simply never be turned into arequireNodeAddon()call. - Whether Metro's async-import handling on Android (inline requires / RAM bundles) defers the module in a way that breaks the TurboModule lookup.
- Whether the failure is a rejected promise or a hard error, and what it actually says — the current comment records the symptom without the message.
Outcome should be either a fix (most likely: handle import() in the Babel plugin alongside require()) or a documented limitation, so the eslint-disable can carry a real explanation instead of an open question.
- Ngôn ngữ chính
- TypeScript
- Star
- 188
- Fork
- 10
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 3
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
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 callstackincubator/react-native-node-api
-
Android 🤖
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Sanity check of Hermes source directory via environment variable, when building Android projects Đang mởAndroid 🤖 good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
callstackincubator/react-native-node-api#163 · 1 bình luận ·
-
enhancement good first issue gyp-to-cmake
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
callstackincubator/react-native-node-api#161 · 3 bình luận · 1 reaction ·
-
enhancement Host 🏡
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
Automatable good first issue
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 15/100
callstackincubator/react-native-node-api#424 · 1 bình luận ·
Tất cả issue của callstackincubator/react-native-node-api
Issue tương tự
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Mend: dependency security vulnerability untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100