render: Prettier is bundled even when `pretty` is never used
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- react, typescript, vite
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 19.9k
- フォーク
- 1.1k
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 61
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
resend/react-email のほかの issue
-
Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
resend/react-email#3889 ·
メンテナーはふだん 1 日以内に返信
-
Tailwind stacked media variants leave nested CSS in rendered emails対応中かも @lakshya-dhariwal が 3 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
resend/react-email#3874 ·
メンテナーはふだん 1 日以内に返信
-
Inspector Text panel omits Uppercase mark toggle (MARK_NAMES missing "uppercase")対応中かも @svargas-dev が 9 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 22/100
resend/react-email#3849 ·
メンテナーはふだん 1 日以内に返信
-
bug(tailwind): `pixelBasedPreset` only converts spacing and font size; `rounded-*` and `max-w-*` still emit `rem`対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
resend/react-email#3845 ·
メンテナーはふだん 1 日以内に返信
-
Dependency Dashboardオープンdependencies
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
resend/react-email#746 ·
メンテナーはふだん 1 日以内に返信
resend/react-email の issue をすべて見る
似ている issue
-
enhancement language
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
pngwn/twinkleplop#178 ·
-
build P3
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
maniator/verticopolis#1945 ·
メンテナーはふだん 1 日以内に返信
-
Admin users page number stays stale after filtering対応中かも @matthewxkong が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
feature request needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
outline/outline#14529 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信