It looks like your using Babel to transpile your javascript, which means you need to do a little extra configuration in order to get it to work with Promises.
Check you babel version, if <7.4.0 you will need: npm install --save @babel/polyfill and in as early as possible in your code: require("@babel/polyfill");.
For later versions you can use import "core-js/stable"; and import "regenerator-runtime/runtime";
See this page at babeljs.io for more information.
I was able to fix the issue by installing npm i -S babel-runtime. Apparently it's a peer dependency of @workpop/graphql-proxy, meaning it doesn't get installed alongside of it. (The only reason I didn't run into this earlier is because node was able to resolve it from an underlying folder on my end.) I will update the article, thanks for bringing it to my attention. Let me know if this fixes the issue for you as well.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi @peerhenry !
I've tried to follow your article to setup playground, but when I run it I get this error, when @workpop/graphql-proxy is required:
internal/modules/cjs/loader.js:1033
throw err;
^
Error: Cannot find module 'babel-runtime/regenerator'
So I wonder: do I miss a step/dependency/version to have it working?
Hi @rebelok ,
It looks like your using Babel to transpile your javascript, which means you need to do a little extra configuration in order to get it to work with Promises.
Check you babel version, if <7.4.0 you will need:
npm install --save @babel/polyfill
and in as early as possible in your code:require("@babel/polyfill");
.For later versions you can use
import "core-js/stable";
andimport "regenerator-runtime/runtime";
See this page at babeljs.io for more information.
I didn't add any code except the code from the article ^_^
Hmm, I could not reproduce the issue. Can you tell me what node version you are using and what are the dependencies listed in package.json?
Here is the repository: github.com/rebelok/graphql-playground
I've tried on nodes 8, 10, 12 and 14 - the result is the same ^_^
I was able to fix the issue by installing
npm i -S babel-runtime
. Apparently it's a peer dependency of@workpop/graphql-proxy
, meaning it doesn't get installed alongside of it. (The only reason I didn't run into this earlier is because node was able to resolve it from an underlying folder on my end.) I will update the article, thanks for bringing it to my attention. Let me know if this fixes the issue for you as well.