Dynamic `import()` of a Node-API addon doesn't work on Android
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- android, babel, react-native, typescript
- Ambito
- build-system, mobile
Direzione di ricerca
Inizia con il TODO in apps/test-app/App.tsx e riproduci il fallimento dell’importazione dinamica su Android, registrando se viene rifiutata o genera un’eccezione e qual è il relativo messaggio. Poi esamina packages/host/src/node/babel-plugin/plugin.ts per confrontare la gestione di require() e import(). Il lavoro è completato quando l’importazione dinamica funziona su Android oppure quando sono documentati il limite e la sua causa, inclusa una spiegazione significativa di eslint-disable.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 188
- Fork
- 10
- Merge medio
- 2g 17h
- PR unite (30g)
- 3
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di callstackincubator/react-native-node-api
-
Android 🤖
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
Sanity check of Hermes source directory via environment variable, when building Android projects ApertaAndroid 🤖 good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
callstackincubator/react-native-node-api#163 · 1 commento ·
-
enhancement good first issue gyp-to-cmake
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
callstackincubator/react-native-node-api#161 · 3 commenti · 1 reazione ·
-
enhancement Host 🏡
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Automatable good first issue
Difficoltà 3/5 1-2 giorni Idoneità per principianti 15/100
callstackincubator/react-native-node-api#424 · 1 commento ·
Tutte le issue di callstackincubator/react-native-node-api
Issue simili
-
blocklist removal
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
pastelsky/bundlephobia#1122 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100