ReqoreIcon imports the whole Remix icon set (react-icons/ri) into every app

Aperta
#727 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
38/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
react, typescript

Direzione di ricerca

Start by reading src/components/Icon/index.tsx, where the issue identifies the namespace import from react-icons/ri and runtime name lookup. Compare the registry and lazy-loading options, then trace how ReqoreIcon resolves and renders names. Done means apps can ship only the icons they use while preserving the stated behavior for registered names; the issue does not name tests or define a choice among the approaches.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What the landing page needs

ReqoreIcon resolves icons by name from the full Remix set:

import * as RemixIcons from 'react-icons/ri'; // src/components/Icon/index.tsx

Every app that uses Reqore therefore ships every Remix icon (about 2,800 components), even if it shows twenty. On the Qorus landing page (qorus.cloud), react-icons is about 19% of the production bundle's source, about as much as Reqore itself. The page is slow to show its first screen on phones: LCP is about 7 s in a throttled trace, mostly script.

This is separate from tree-shaking (the ESM issue). A name looked up at runtime keeps the whole namespace alive whatever the module format.

Options

  1. An icon registry: registerIcons({ ArrowRightLine, ... }), with apps importing the icons they use. icon="Name" keeps working for registered names. Optionally a dev-mode warning for a name that isn't registered.
  2. Lazy loading by name: split the set into small chunks and load the one that holds a name on first use. The API doesn't change, but icons appear a moment later.
  3. Both: a registry for the first screen, and lazy loading as the fallback for any other name.

Option 1 or 3 would let the landing page (and qorus-ide) ship only what they draw.

Lingua principale
TypeScript
Stelle
4
Fork
0
Merge medio
16h 28m
PR unite (30g)
9

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di qoretechnologies/reqore

Tutte le issue di qoretechnologies/reqore

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.