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

Convert to have both commjs and esm compat #537

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Gobd
Copy link

@Gobd Gobd commented Jan 12, 2025

Closes #534

This PR is not ready to merge but I wanted to get it up as an example of how this could be done. I could complete the remaing work if there is interest from the maintainers. Now to release you'd have to run npm run build then you'd get a dist folder with the releaseable files.

Copy link
Contributor

@ilteoood ilteoood left a comment

Choose a reason for hiding this comment

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

I have nothing against this change.
@simoneb what do you think?

package.json Outdated
@@ -40,7 +40,7 @@
"dist/**"
],
"scripts": {
"build": "tsc -p tsconfig-cjs.json && tsc -p tsconfig-es.json",
"build": "tsc -p tsconfig-cjs.json && tsc -p tsconfig-es.json && renamer --find mjs --replace js ./dist/cjs/*",
Copy link
Contributor

Choose a reason for hiding this comment

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

To make things a bit easier I think you could use https://github.com/egoist/tsup

Copy link
Author

Choose a reason for hiding this comment

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

Nice I'll check that out and see how to use that

Copy link
Author

Choose a reason for hiding this comment

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

Done! Not sure if it's a breaking change to now just have index.js and all the other files gone. The tsc method kept all of the files the same if this is a breaking change.

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.

Add ESM exports
2 participants