-
Notifications
You must be signed in to change notification settings - Fork 4
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 alongside CJS #128
Comments
Why not just distribute ESM (instead of only CJS, which is what we're doing now). It's been 6 years since ESM support was added to nodejs, the ecosystem has moved on and you're creating more work for yourself. Edit: I bumped into this issue today because we're unable to upgrade to |
Unfortunately supporting both (in the Apollo Server project) is a requirement for now. This package does not have to follow that requirement since this is a community project in theory (and in practice once someone other than myself wants to maintain it) but as long as I'm maintaining it my preference would be to ship both. It might be a bit more work, but it's work we've done before, should be able to replicate fairly easily, and we only have to do it once. Alternatively, we can fork this repo and ship a new ESM-only package if that's something you'd be interested in maintaining. I'd be equally happy with that outcome. Apollo's reality is that we support customers who use CJS, so while plenty of popular packages have made the decision to move on, that's not an option for us yet. |
It is work that's been done before incorrectly. Right now, today, Apollo Server suffers from the dual package hazard. Instances of a server created from ESM will be similar but unrelated to instances created in CJS. This will lead to subtle bugs where We can observe this in the CLI:
To correctly support dual exports is actually pretty annoying with lots of tradeoffs. The incorrect support for dual package exports in |
Fair point, I'll be sure to get it addressed in AS first before I duplicate anything that's incorrect and propagate the issue. In the meantime, forking it yourself or creating an ESM-only repo to live in this org are my best options for you. |
Yeah definitely. It's a single file so I think we're just going to copy/paste into our repository. Thanks! |
Issue for tracking ESM support. PRs welcome!
@apollo/server
distributes both, so that could provide some inspiration for the work necessary to implement this.The text was updated successfully, but these errors were encountered: