FormidableLabs / FormidableLabs/react-live

Support for JSX automatic runtime

Ouverte
#405 1 commentaire 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
4.6k
Forks
260
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

### Feature Request

```markdown
When upgrading Docusaurus to React 19, I noticed some warnings in documentation pages containing React-Live playgrounds

It turns out React 19 has a new warning in dev mode:

VM59912:5 Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform Error Component Stack
at Hello ()
at ErrorBoundary (eval at ../node_modules/react-live/dist/index.mjs (vendors-node_modules_parse-numeric-range_index_js-node_modules_react-live_dist_index_mjs-node-bdedd5.js:338:1), :161:10)
at div ()
at LivePreview (eval at ../node_modules/react-live/dist/index.mjs (vendors-node_modules_parse-numeric-range_index_js-node_modules_react-live_dist_index_mjs-node-bdedd5.js:338:1), :331:29)
at ErrorBoundary (eval at ../packages/docusaurus/lib/client/exports/ErrorBoundary.js (main.js:1021:1), :29:9)
at BrowserOnly (eval at ../packages/docusaurus/lib/client/exports/BrowserOnly.js (__comp---theme-blog-post-pageccc-cab.js:488:1), :19:24)
at Preview ()
```

By default, React-Live is using Sucrase to transform the code, but there's no ability to customize the JSX runtime (classic by default).

An option to turn on the automatic runtime would be welcome to get rid of this warning.

---

To be honest, I'm not 100% sure why there is a warning, considering `React.createElement` is considered fine although not optimal according to the linked page.

> Note
> The functions inside react/jsx-runtime and react/jsx-dev-runtime must only be used by the compiler transform. If you need to manually create elements in your code, you should keep using React.createElement. It will continue to work and is not going away.

In any case, it looks future proof to support the automatic runtime in this lib

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par suivre le chemin de transformation de Sucrase dans React-Live, en vous concentrant sur la manière dont JSX est actuellement compilé et sur l’endroit où les options de transformation sont exposées. Ajoutez la prise en charge de la sélection du runtime JSX automatique de React, puis vérifiez que React 19 ne signale plus l’avertissement concernant la transformation JSX obsolète dans les playgrounds en direct.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
react, typescript
Domaine
frontend
Type d'issue
Fonctionnalité
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
65/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.