render: Prettier is bundled even when `pretty` is never used
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript, vite
- Ambito
- build-system, performance
Direzione di ricerca
Start by tracing how render() handles the pretty option and how the package exports render and pretty; the issue names no source files or tests. Compare the proposed core entry point with removing the option in a major release, then check how each affects bundler output for the Vite SSR reproduction. Done means callers that never use pretty can avoid Prettier in their bundle while pretty formatting remains available.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Versions
react-email 6.11.8, @react-email/render 2.2.0, prettier 3.9.10
Problem
render() only uses Prettier when options.pretty is set, but because that branch reaches import("prettier/standalone"), bundlers have to include Prettier for every caller of render. The option is only known at runtime, so the import can't be tree-shaken.
In a Vite SSR build for Cloudflare Workers that never sets pretty, the Worker bundle gets two extra chunks:
| Chunk | Raw | Gzip |
|---|---|---|
prettier/standalone |
103 KB | 30 KB |
prettier/plugins/html |
197 KB | 55 KB |
| Total | 299 KB | 85 KB |
The code never runs, but it still counts toward the Worker's upload size.
Relation to #3608
#3608 asked to drop Prettier as a dependency, and I'm not asking for that. It's fine as a dependency, and these numbers match the 83 KB gzipped mentioned there. Using a bundler was the suggested fix, but the bundler is what can't remove it here.
To reproduce
import { render } from 'react-email';
export const getHtml = (body: React.ReactElement) => render(body);
Build this for SSR with Vite and look for standalone-*.js and html-*.js in the output.
Suggested fix
pretty is already a separate export and the package has "sideEffects": false, so the if (options?.pretty) branch in render is the only thing keeping Prettier in the graph. Either of these would let bundlers drop it:
- Add an entry point whose
renderhas noprettyoption, such as@react-email/render/core. This is non-breaking. - Deprecate the option in favour of
pretty(await render(element)), and remove it in the next major version.
- Lingua principale
- TypeScript
- Stelle
- 19.9k
- Fork
- 1.1k
- Merge medio
- 2g 15h
- PR unite (30g)
- 61
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
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 resend/react-email
-
Type: Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
resend/react-email#3889 ·
I maintainer di solito rispondono entro 1 giorno
-
Tailwind stacked media variants leave nested CSS in rendered emailsForse già presa @lakshya-dhariwal l’ha presa 3 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
resend/react-email#3874 ·
I maintainer di solito rispondono entro 1 giorno
-
Inspector Text panel omits Uppercase mark toggle (MARK_NAMES missing "uppercase")Forse già presa @svargas-dev l’ha presa 9 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 22/100
resend/react-email#3849 ·
I maintainer di solito rispondono entro 1 giorno
-
bug(tailwind): `pixelBasedPreset` only converts spacing and font size; `rounded-*` and `max-w-*` still emit `rem`Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
resend/react-email#3845 ·
I maintainer di solito rispondono entro 1 giorno
-
Dependency DashboardApertadependencies
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
resend/react-email#746 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di resend/react-email
Issue simili
-
Language request: NixApertaenhancement language
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
pngwn/twinkleplop#178 ·
-
build P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
maniator/verticopolis#1945 ·
I maintainer di solito rispondono entro 1 giorno
-
Admin users page number stays stale after filteringForse già presa @matthewxkong l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
feature request needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
outline/outline#14529 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno