fix(render): make prettier an optional peer dependency
Closes #3608.
prettier was a hard dependency of @react-email/render but is only used on the pretty: true path, which is off by default. This moves it to an optional peer dependency and lazily loads it with a dynamic import, so it no longer ships to consumers who never prettify.
Following @y-nk's outline on the issue (optional dep + dynamic import). One open call: when pretty: true is used without prettier installed, this returns the unformatted HTML and warns once (rather than throwing, since editor/ui call pretty() directly). I can make it a hard throw instead if that's preferred.
Summary by cubic
Make prettier optional in @react-email/render and load it only when pretty: true is used. This reduces install and bundle size for consumers who don’t prettify, with identical output when prettier is present.
- Dependencies
- Moved
prettierfromdependenciesto an optionalpeerDependencyand kept it indevDependenciesfor this repo. - Dynamically import
prettier/standaloneandprettier/plugins/htmlonly whenpretty: trueis requested. - If
pretty: trueis used withoutprettierinstalled, return unformatted HTML and log a one-time warning. - Formatting behavior is unchanged when
prettieris installed (custom HTML printer tweaks are preserved).
- Moved