-
Notifications
You must be signed in to change notification settings - Fork 23
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
distribute ESM version #50
Comments
Yeah, I suppose we ought to do that. Fair warning, though: I just went through a similar transition with a different project, and was more work than it sounded on the surface. The main thing I want is to keep backwards compatibility for existing users, so keep a CJS version and no I suspect that the best way to do it is probably a thin ESM wrapper that just re-exports the existing CJS module and provides a named and/or default export. |
@nfriedly Hi 👋 would you consider adding a small script to generate the ESM version? It doesn't add dependencies or anything, it just concatenates the CJS version with an extra bit of code in an |
Hum, that's an interesting idea, I like the simplicity. What I had been thinking about was converting it to typescript, and then having tsc run twice to output both esm and cjs versions of the library, but I've done that with a few other libraries and it's a decent amount of work each time. If you want to send in a PR to add the conversion script, I'll go ahead and merge it in, and I'll punt typescript for some other day (or maybe never). |
A couple of thoughts if we go with a generation script:
|
I also wonder if it should go in the opposite direction. Start with esm source and then generate the cjs version. Esm will be around longer-term and eventually everyone will be dropping cjs. That would make it easier for this library in the future as then you can just drop the generation script when the time comes and don't have to update the source |
Yeah, that makes sense. |
I was wondering if you'd be open to a PR to convert to ESM and what your thoughts are about ESM vs CJS, etc.
The text was updated successfully, but these errors were encountered: