apps/docs/getting-started/monorepo-setup/yarn.mdx
Create a new folder called transactional inside of where you keep workspace packages (generally ./packages/*).
Include a new package.json and do not forget to add this to the workspaces of your monorepo's package.json.
<Card title="React Email + Turborepo + yarn example" icon="arrow-up-right-from-square" href="https://github.com/resend/react-email-turborepo-yarn-example"
See the full source code </Card>
node-modules or to pnpmCurrently, React Email can only work with yarn's node-modules and pnpm install modes
so you will need to set it to one of these two on your .yarnrc.yml file:
nodeLinker: node-modules
Install React Email in the transactional workspace.
yarn add react-email @react-email/preview-server -D -E
yarn add @react-email/components react react-dom -E
Include the following script in your package.json file.
{
// ...
"scripts": {
"dev": "email dev"
}
// ...
}
Create a new folder called emails, create a file inside called email.tsx and add the following example code:
import { Button, Html, Head, Body } from "@react-email/components";
import * as React from "react";
export default function Email() {
return (
<Html>
<Head />
<Body>
<Button
href="https://example.com"
style={{ background: "#000", color: "#fff", padding: "12px 20px" }}
>
Click me
</Button>
</Body>
</Html>
);
}
Start the email previews development server:
yarn dev
Visit localhost:3000 and edit the emails/email.tsx file to see the changes.
<Card title="React Email + Turborepo + yarn example" icon="arrow-up-right-from-square" href="https://github.com/resend/react-email-turborepo-yarn-example"
See the full source code </Card>