-
Notifications
You must be signed in to change notification settings - Fork 401
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
Support for ESM added, then removed? #160
Comments
You're correct about my motivation for rolling back the changes: this broke the script in other environments and I value backwards compatibility. Please note that I haven't actually 'released' the current state of the repo to NPM so if I can work out how to add ESM support in a non-breaking fashion, I'm open to it. My understanding is that ESM and CJS modules are fundamentally incompatible, though I could be wrong. However, if you or someone else creates your own package which exposes this script as an ESM, I'll gladly link to it in the readme for this project. The same principle applies to anything related to TypeScript, etc. |
That makes sense. After reading your message, I did a bit of digging to see how others have attempted to solve this issue (because there appear to be a lot of packages that have solved this, with build processes of varying complexity). I found a few things that were helpful in understanding what a solution could look like:
TL;DR Node has a way to provide support for both
I'm not sure what that build step would look like (Babel? Rollup? something else?) but it would surely be a simple configuration 👍 Edit: this is not a request for you to implement these changes, more of "this is what I found" kinda thing haha, I have nothing but respect for open-source maintainers such as yourself |
Hey @davidmerfield!
Thanks for this package, it's a neat and simple tool that I find really useful, especially for seeding colors based on inputs.
I wanted to ask a question though: I see ESM support was added in #134 but then shortly after was removed in ff971fa. I'm wondering, was that on account of the changes from the PR breaking use of this module in other environments? That seems like what was going on. Since the version of this package available on
npm
is Node-first (non-browser compatible), it makes sense that going fully ESM would cause issues.Maybe I've answered my own question, but at any rate, ESM-native imports would be a nice thing to have, especially through
npm
. Do you plan on re-adding ESM support in the future (of course, this being open-source I am not asking or demanding anything, just curious if that's a direction you are planning to go in).Thanks!
The text was updated successfully, but these errors were encountered: