jiangtaste / nestjs-resend

NestJS provider for sending emails with resend
MIT License
57 stars 3 forks source link

React is not defined #159

Closed jimmysafe closed 4 weeks ago

jimmysafe commented 1 month ago

Describe the bug In one of the examples its shown that we can send a React email through this service. Unfortunately i'm not able to send an React email with this package, im sure i'm doing something wrong.

I keep getting React is not defined.

To Reproduce Steps to reproduce the behavior:

// app.module.ts
...
ResendModule.forRoot({
      apiKey: 'myapikey'
})
...
// src/email/templates/login-verification-code.tsx

import * as React from 'react'

export function LoginCodeVerification({ code }) {
  return (
    <div>HELLO IM A REACT EMAIL</div>
  );
}
// myservice.ts

  await this.resendService.send({
    from: 'email@email.com',
    subject: 'Your verification code',
    to: [email],
    react: LoginCodeVerification({ code }),
  });
// tsconfig.json

{
  "compilerOptions": {
    "jsx": "react",
    "module": "commonjs",
    "target": "ES2021",
    "moduleResolution": "Node16",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "skipLibCheck": true,
    "strictNullChecks": false,
    "noImplicitAny": false,
    "strictBindCallApply": false,
    "forceConsistentCasingInFileNames": false,
    "noFallthroughCasesInSwitch": false
  }
}

Expected behavior I should be able to create a react component

Screenshots Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

This might not be an issue with the package itself. i really hope you could help on this <3

jiangtaste commented 4 weeks ago

Using React is a capability provided by the official Resend SDK. The nestjs-resend package is merely a wrapper to adapt it for NestJS and does not offer deeper functionality at this time, so I'm unable to assist you further.