Skip to content
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

Investigate ESM support #6243

Closed
trevor-scheer opened this issue Mar 21, 2022 · 6 comments
Closed

Investigate ESM support #6243

trevor-scheer opened this issue Mar 21, 2022 · 6 comments
Milestone

Comments

@trevor-scheer
Copy link
Member

Apollo Server and friends are compiled for CJS. It would be nice to build for ESM as well.

Reference: https://community.apollographql.com/t/responsecacheplugin-is-not-a-function/2796/2

@trevor-scheer trevor-scheer added this to the Release 4.0 milestone Mar 21, 2022
@glasser
Copy link
Member

glasser commented Mar 22, 2022

https://github.com/benduran/package-bundler might be nice — a new tool inspired by how @apollo/client works.

@glasser
Copy link
Member

glasser commented Jun 3, 2022

Note that as part of this we would probably want a separate entry point for standalone so we don't have to import express/cors/body-parser if we don't use it.

glasser added a commit that referenced this issue Jun 3, 2022
Keeping it separate mostly just means we have to worry about version
skew. It doesn't let us avoid the protobufjs dependency (it was just
transitive). Other packages that may need these types (like
`@apollo/gateway`) will have a peer dependency on `@apollo/server`
anyway.

Note that this package consists of .js and .d.ts files that are not
generated from .ts files, so they exist outside of `src`. We ensure they
end up in the published package via a change to `.npmignore`.

As before, the only code that can import the protobuf code should be
tests, `import type`s, or code under `src/plugin` that is only evaluated
if the plugin is actually used.

Also fixes missing dependencies on cors and body-parser needed for
the standalone server. (As part of #6243 we may make sure that these are
only needed if you actually import the standalone server directory.)

Fixes #6510.
@alfaproject
Copy link
Contributor

FYI: this seems like a duplicate of #5627
Should we close that one?

@glasser
Copy link
Member

glasser commented Jun 6, 2022

(It would also be nice if we could drop src/plugin/index.ts while still keeping its advantages.)

@alfaproject technically #5627 is "do a thing" and #6243 is "consider doing a thing as part of the AS4 work" though they are certainly related.

@glasser
Copy link
Member

glasser commented Jun 15, 2022

I think I have this working at #6580

@glasser
Copy link
Member

glasser commented Jun 21, 2022

This is finished with #6580. #6586 is a follow-up.

@glasser glasser closed this as completed Jun 21, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants