-
Notifications
You must be signed in to change notification settings - Fork 15
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
Discussion: Consider ESM mirrors for widely used packages #297
Comments
A maintenance cost has been brought up on Twitter, and to that I advise to dual-publish. The same source, different build targets. This requires little-to-none additional maintenance cost when it comes to bug fixes or new features. Compared to a designated mirror, which likely requires someone to backport changes. Note that I don't imply dual-publishing to the same namespace on npm. Only that it may be more beneficial to keep the same source. You can publish any directory with |
I have a lot of thoughts on this, and only 7 minutes before I have a meeting. I just wanted to drop my first comment: I think there are a few decisions we need to make on this first before we decide how we are going to support it:
|
I see no benefit in shipping native ESM in any form until it becomes widely usable everywhere (namely, after node’s require ESM feature is shipping in all supported release lines, for many years) a dual package creates tons of problems and complexity, and ESM-only is user-hostile until the time i previously referred to. |
+1 on the Wes' comment. IMO maybe we are not in a good time for this, but I don't discard to revisit this again in the future 🤔 |
Thanks everyone for sharing their thoughts.
No, we don't. This proposal is not about adopting ESM. It's about mirroring the existing code to ESM. You can keep the package source as-is, and use a bundler to output an ESM build.
You are the right to decide here, but I strongly advise TypeScript.
@ljharb, this is catch 22. How do we expect ESM to get widely usable if we don't want to adopt it before it is? IMO, packages like Let's make it abundantly clear that we are waiting on no one here. Developers cannot adopt ESM because they are blocked by third party packages. Third parties cannot adopt ESM because they are blocked by packages like But I digress. Once again, this proposal is not about adopting ESM. It's about giving the ESM consumers a way to consume your packages. If community-maintained mirror packages can do that, I don't see why you shouldn't provide a more maintained and stable version of that. You can keep CJS if you so choose, but it doesn't mean not providing ESM options. Those aren't mutually exclusive. |
If it is good enough, it will get wide usage on its own. If it needs to be helped or pushed or forced, that indicates that it shouldnt get wide usage. CJS is usable from within ESM via every tool I’m aware of. It’s simply not a practical or common constraint that native ESM is needed. Mirror packages just increase the risk of supply chain security attack vectors, as well as maintenance burden, for a dubious benefit. |
That is a rather odd position to have, but if my arguments didn't convince you, so be it.
It's not a practical and common constraint because there are packages that prevent it from becoming a practical and common constraint. I struggle to see how build-less JavaScript isn't something everybody would want. The same code that I can just run anywhere. No bundlers, no
Have you considered what I proposed then? Minor maintenance cost, about the same supply chain risk as the package has right now. Would love to hear your opinion on this. |
Buildless is inherently slower (ESM has the waterfall problem any time a remote URL is used, which includes browsers) and means you can’t apply the many optimizations bundlers and build tools are best at. Dual publishing creates a hazard if there’s anything in the package that depends on identity, or has state. This is possible to do safely but is very easy to mess up. |
We can use tshy to do this safely. Afaik, Meanwhile, I will also explore |
It can’t be automated and tshy simply can’t prevent this problem - it certainly does a good job automating the rest though. |
Hi 👋
I would like to bring up the topic of creating official ESM mirrors for widely used packages like
cookie
.Motivation
cookie
. I'm not proposing this for every package.cookie
, then who?This proposal originates from my Twitter post.
Execution
You can choose to have a standalone repo or keep the ESM mirror within the same repository. I leave that decision to you.
I would be more than happy to discuss this and help with organizing the repo to provision ESM publishing. Thank you.
The text was updated successfully, but these errors were encountered: