Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Package build #259

Merged

Conversation

gabrielmfern
Copy link
Contributor

What does this change?

This just substitutes the use of tsc for build, and uses tsup instead.
This also adds specifications for esm and cjs interoperability on the package.json so
that imports/requires don't get mixed up.

Why is it necessary?

The missing interoperability between esm and cjs caused problems on next builds
and due to that some issues were openned on react-email reporting problems on build.

For the record, here is the error that was happening before:

./node_modules/@react-email/components/node_modules/html-to-text/lib/html-to-text.mjs + 24 modules
Cannot get final name for export 'encodeXML' of ./node_modules/entities/lib/esm/index.js

Also, here is the original issue from react-email.

How does this solve the issue?

After investigating for a bit and testing out a few things I found out the problem
was on the Resend SDK, and after searching found out about this issue on NextJS that said this kind of error was due to missing interoperability between esm and cjs.

Besides this evidence, I have tested and confirm this works by copying the dist and substituting the
resend module with the newly compiled one and the build worked on an existing project.

@bukinoshita bukinoshita changed the title fix (build): problems with next builds that used the sdk fix(root): Package build Nov 6, 2023
@bukinoshita bukinoshita changed the title fix(root): Package build fix: Package build Nov 6, 2023
@gabrielmfern
Copy link
Contributor Author

gabrielmfern commented Nov 7, 2023

Closes #256

I have tested this out on a repo by copying the new dist into the node_modules and can
confirm this solves the issues that were happening with builds for next.

see vercel/next.js#39375 for more info
@bukinoshita bukinoshita merged commit 39b8d38 into resend:canary Nov 22, 2023
4 checks passed
@gabrielmfern gabrielmfern deleted the fix/next-build-error-with-react-email branch March 25, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants