chore(docs): note tsup + emitDecoratorMetadata gotcha for render#3470
chore(docs): note tsup + emitDecoratorMetadata gotcha for render#3470mvanhorn wants to merge 1 commit intoresend:canaryfrom
Conversation
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.
|
@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.
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
Add a note to the Render utility docs about a
tsup+emitDecoratorMetadatabuild gotcha that can causeReferenceError: React is not definedin production. It explains theSWCrouting with classic JSX andexternal: ["react"]cause, and lists three fixes (use the automatic JSX runtime, remove the external for that entry, or force.tsxback toesbuild), fixing #3177.Written for commit e822ffb. Summary will update on new commits.