Apollo-server: Do not activate polyfills automatically when using Apollo Server.

Created on 29 Apr 2019  ·  3Comments  ·  Source: apollographql/apollo-server

when using node10, the method Array.flat does not exist. but, if i require apollo-server-express first, then it suddenly starts to exist.

try this example code:

console.log([].flat);
require('apollo-server-express');
console.log([].flat);

if you run it with node10, you get:

[Function: flat]

what i would like to happen is:

undefined

a module should not modify the global namespace.

seems a polyfill gets activated. i started to dig into the dependencies-tree, and it seems it goes:

  > apollo-server-core
    > @apollographql/apollo-tools
      > apollo-env
        > core-js

so technically apollo-env is the one that activates the polyfill, but i do not know what that module does or why is it used, so i decided to create the bugreport here.

⛲️ feature 🍳 breaking-change 🖇️ all-integrations

Most helpful comment

We just wasted 2 hours tracking down an issue that was exactly this. What's the status of ripping out the polyfill behavior? It's honestly unacceptable for a runtime library.

All 3 comments

Hey thanks for pointing this out. We will be moving to requiring projects to supply their own polyfills in a future release of Apollo Server, but as that would be a breaking change it will need to wait for Apollo Server 3.

We just wasted 2 hours tracking down an issue that was exactly this. What's the status of ripping out the polyfill behavior? It's honestly unacceptable for a runtime library.

@abernix Looks like you were doing something related to this a few weeks ago over in apollo-env. I'm not particularly expert on polyfills or how they are used in AS. Thoughts on what if anything we should do here as part of AS3?

Was this page helpful?
0 / 5 - 0 ratings