chore(docs): note tsup + emitDecoratorMetadata gotcha for render#3470
chore(docs): note tsup + emitDecoratorMetadata gotcha for render#3470mvanhorn wants to merge 3 commits into
Conversation
|
@mvanhorn is attempting to deploy a commit to the resend Team on Vercel. A member of the Team first needs to authorize it. |
|
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Documentation-only change adding a note about tsup and decorator metadata gotcha. No code, config, or logic changes. Low risk.
Per @gabrielmfern's review on PR resend#3470: the tsup + emitDecoratorMetadata gotcha was sitting as a one-off section under Options on the render page. Lift it into a dedicated guides/common-problems/ subgroup so the section can grow with future entries, and leave a short "Common problems" pointer on render.mdx.
|
Pushed 525dcf0 in response to your common-problems suggestion:
Let me know if you'd rather the guide live under a different parent (e.g. top-level Troubleshooting tab) or want a different page title. |
When tsup is configured with `emitDecoratorMetadata: true` and `external: ["react"]`, .tsx files get routed through SWC which defaults to the classic JSX runtime, leaving the output referencing `React` without importing it. Document the failure mode and three mitigations (automatic JSX runtime, drop the external, or force esbuild for .tsx) on the Render utility page so backend users hitting this in NestJS / type-graphql / TypeORM stacks have somewhere to land. Closes resend#3177 AI was used for assistance.
Per @gabrielmfern's review on PR resend#3470: the tsup + emitDecoratorMetadata gotcha was sitting as a one-off section under Options on the render page. Lift it into a dedicated guides/common-problems/ subgroup so the section can grow with future entries, and leave a short "Common problems" pointer on render.mdx.
525dcf0 to
db78373
Compare
|
Hey @mvanhorn, let's get this one to the finish line too, Sorry for the delay! I think a "troubleshooting" group/section would be easier to find when searching. Can you rename it instead of "common problems" I can also do that, just let me know! |
Per @dielduarte's review on resend#3470: troubleshooting is more discoverable in docs search than 'common problems'. - Rename group label in docs.json - Move guides/common-problems/ -> guides/troubleshooting/ - Update sidebar pages path and the cross-reference in render.mdx
There was a problem hiding this comment.
0 issues found across 3 files (changes from recent commits).
Auto-approved: This is purely a documentation update adding a troubleshooting guide for a build-time issue, with no changes to application logic, infrastructure, or dependencies.
Re-trigger cubic
|
Done in 2afb57e — renamed the group to Ready for another pass whenever. |
Summary
Document the
tsup+emitDecoratorMetadatabuild gotcha on the Render utility page so backend users hittingReferenceError: React is not definedin production bundles have somewhere to land.Why this matters
Issue #3177 reports the failure mode and explicitly frames it as "worth a docs mention since it affects an unrelated tsconfig flag." The chain is:
emitDecoratorMetadata: truemakes tsup route.tsxthrough SWC instead of esbuild (egoist/tsup#792)React.createElementcallsexternal: ["react"], the bundle referencesReactwithout importing itThis affects any TS project that needs runtime decorator metadata (NestJS, type-graphql, TypeORM).
Changes
A new section at the end of
apps/docs/utilities/render.mdx: failure symptom, the SWC routing chain, three mitigations (automatic JSX runtime, drop the external for the affected entry, or force tsup back to esbuild for.tsx), and a link to the upstream tsup issue.Testing
pnpm lintpasses (one pre-existing warning unrelated to this change). Mintlify validation against the local Node version was blocked by the LTS requirement; the section uses standard markdown that Mintlify renders verbatim.Fixes #3177
Summary by cubic
Added a Troubleshooting guide for the
tsup+emitDecoratorMetadatagotcha that makesrender()fail withReferenceError: React is not definedin production. It’s linked fromrender()and appears under the docs sidebar’s “Troubleshooting”; the guide explains theSWC+ classic JSX withexternal: ["react"]cause and three fixes: switch to the automatic JSX runtime, remove theexternalfor that entry, or force.tsxback toesbuild(fixes #3177).Written for commit 2afb57e. Summary will update on new commits. Review in cubic