Graphcool / graphcool-framework

Apache License 2.0
1.77k stars 131 forks source link

ES2016+ in node_modules #529

Open marktani opened 6 years ago

marktani commented 6 years ago

@anthonyshort commented on Sat Dec 16 2017

What feature are you missing? Modules from npm that include async/await, arrow functions, etc., seem to fail when a function runs. Specifically, I'm seeing a syntax error for an arrow function which I can only assume is because the version of node of the environment the function runs on it older. Lambda runs Node v6, I think?

What's the solution for working with external modules that include features not available in node v6? I feel like I'm missing something obvious. My options seem to be:

  1. Creating a bundle for each modules that includes es2016+ code. But this doesn't work as soon as I include a module that has an arrow function.
  2. Running a custom build in the project instead of relying on the included typescript compiler.

How could this feature look like in detail? Tradeoffs? Both of these options seem a bit painful, so this seems like it should be something the framework handles. It might be possible to just create a single bundle file for each function, instead of just compiling the ts.