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

feat: Add cjs support #195

Merged
merged 1 commit into from
Oct 14, 2022
Merged

feat: Add cjs support #195

merged 1 commit into from
Oct 14, 2022

Conversation

searchableguy
Copy link
Contributor

fixes #190

PR adds cjs support alongside esm.

Feel free to close if this cjs support is unwarranted.

@vercel
Copy link

vercel bot commented Oct 14, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
satori-playground ✅ Ready (Inspect) Visit Preview Oct 14, 2022 at 8:17AM (UTC)

Copy link
Member

@shuding shuding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, would love to take this one! One last quest is that did you test the CJS build?

@searchableguy
Copy link
Contributor Author

searchableguy commented Oct 14, 2022

Yes, I tested the cjs build.

const { default: satori } = require("satori")
console.log(satori)

Unfortunately, the default import doesn't work out of the box with cjs but you can export .default in another file and have it in place of generated one.

For ref on tsup regarding above: egoist/tsup#572

I will leave to decision to add that extra re-export file up to you.

@shuding
Copy link
Member

shuding commented Oct 14, 2022

I think this is fine, thanks again!

@shuding shuding merged commit 78d2d5d into vercel:main Oct 14, 2022
@searchableguy
Copy link
Contributor Author

@shuding Thank you so much. Do you think you would be able to cut a release?

@shuding
Copy link
Member

shuding commented Oct 14, 2022

@searchableguy Just got satori@0.0.41 released. Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add export for cjs to support compatibility with older codebases
3 participants