@react-email/tailwind package which currently uses vite due to a few issues with tsup and tailwindcss’s bundling.)
To build a package run:
package/* (ex: package/render)
tsup with a few settings, typically src/index.ts --format esm,cjs --dts --external react.
Tsup handles building both ESM and
CJS versions along with the type definitions exported from the entry point, src/index.ts, without bundling react, which can cause issues.
Why build before publishing?
We build most of the packages before publishing for a few reasons:- All the exported types can be imported from the same place the JavaScript is imported
- We have proper CommonJS and ES Modules support
- Code that isn’t exported is not published or downloaded