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: enable usage in both CommonJS and ESM environments #16

Merged
merged 1 commit into from
Dec 18, 2024
Merged

Conversation

achou11
Copy link
Member

@achou11 achou11 commented Dec 18, 2024

Consumption of this module is used in a variety of environments where the tooling for module resolution is quite varied e.g:

  • Metro, which is primarily CommonJS-first but has improving support for ESM-based modules based on some internal configurations
  • Jest, which has limited ESM support out of the box
  • Vite

Ideally I wanted to keep this module purely as an ESM-only module, but in early attempts of integrating with our applications (especially React Native), I've found it quite tedious to deal with the headaches of the tools due to differing support of pure ESM modules. To alleviate this headache, this PR introduces tshy to set up dual publishing of both ESM and CommonJS. It's quite opinionated but it works sufficiently for the needs of this module.

@achou11
Copy link
Member Author

achou11 commented Dec 18, 2024

Tested a packed version of this branch in comapeo-mobile + comapeo-desktop and things seem to be working well!

@achou11 achou11 merged commit f8a6f9e into main Dec 18, 2024
3 checks passed
@achou11 achou11 deleted the ac/tshy branch December 18, 2024 18:31
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.

1 participant