Key error shows internal code frames
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C++
- Sterne
- 127k
- Forks
- 25.3k
- Ø Merge
- 1 T. 23 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
Description
In LogBox, when there's a key error from React, the code frame should point to the application code causing the issue, but in 0.73 (and maybe other versions) it points to the react-jsx-runtime:
The fix is to add '/node_modules/react/cjs/react-jsx-runtime.+\\.js', to the config here:
https://github.com/facebook/react-native/blob/main/packages/metro-config/index.js#L15
Really we should probably have all of '/node_modules/react/.+\\.js$', there.
Steps to reproduce
- trigger key error
- open logbox warning
- see wrong code frame
React Native Version
0.73.0
Affected Platforms
Runtime - Android, Runtime - iOS
Output of npx react-native info
No
Stacktrace or Logs
No
Reproducer
No
Screenshots and Videos
Above
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in packages/metro-config/index.js ungefähr bei Zeile 15, wo die code-frame-Konfiguration definiert ist. Reproduziere den zentralen Fehler in LogBox und prüfe, welche React-Runtime-Datei anstelle des Anwendungscodes ausgewählt wird. Erledigt ist es, wenn die Warnung auf den Anwendungscode statt auf eine interne react-jsx-runtime-Datei verweist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- react, react-native
- Bereich
- mobile, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100