-
-
Notifications
You must be signed in to change notification settings - Fork 139
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 ESM #484
Comments
Hi, here's 1 data point that may be in favor of giving it some time: TypeStrong/ts-node#1997 It seems like ts-node is popular and a lot of developers rely on it, so it may be counter-productive to break it now. I share your sentiment about issues with Sindre's excellent packages being ESM only. If it's any help, I was faced with the same issue and decided to stay on CommonJS, even if it means sticking with older utilities for a while. |
For what it is worth, https://github.com/gajus/lightship has been converted to ESM, and we are using it in CommonJS project (it compiles to ESM and CJS). As far as I can tell, it works with no issue. |
That's a reassuring success story, thanks. I guess my worry is, if some transitive runtime dependency of slonik is ESM-only, then even if this package itself is somehow built as CJS, an attempt to require() it might fail due to that dependency. Which would effectively "taint" the entire dependency tree... unless I'm missing something. I'm just one developer and I'd hate to stifle progress - just saying that my experience, at this point in time, has been rather miserable with ESM-only dependencies and ts-node's loader support clashing with recent Node.js (20.x) changes on this front. So, if this isn't very high-priority for you, it may be prudent to wait a bit for tooling support to get better. |
I think as long as it joint compiles ESM + CJS for the time being (until the rest of the world catches up) I use nx monorepo (https://github.com/nrwl/nx) and their node generators and ability to generate dependency graph seem stuck a bit on CJS for the next while. In order to have shared libraries between modern front-end react frameworks (e.g. Vite, Astro, etc) and express/fastify/etc backends I build both ESM + CJS. Its cool to have slonik + related code in libs where they can freely import zod schemas from libs that are mutually shared front-end and back-end and everything Just Works (tm). Sharing this use-case for consideration while you plan the future of this wonderful library :) Thanks a lot for your work on slonik and the extremely detailed and thoughtful articles. They are few but they are powerful heavy hitters that I have shared many times! |
Now that ESM is stable, it is time to evaluate converting Slonik to an ESM dependency, just like all Sindre's packages.
Not doing this has also been a blocker from updating several dependencies.
For now, I am starting with lesser known packages, such as Lightship that became ESM since v8 and collecting feedback. However, raising this issue to open a discussion if necessary.
The text was updated successfully, but these errors were encountered: