Reputation: 2527
I am getting the following error:
ReferenceError: regeneratorRuntime is not defined
and it is caused by
_asyncToGenerator(regeneratorRuntime.mark(function _callee() {
I have tried the methods in Babel 6 regeneratorRuntime is not defined with async/await and also RegeneratorRuntime is not defined, but have no luck.
My .babelrc
is as below
{
"presets":["latest"]
}
I am able to solve the problem by add require('babel-polyfill')
however this line will throw problem if I run it with babel-node
during development time.
Anyone faced similar problem before?
Upvotes: 3
Views: 1884
Reputation: 892
Add babel-polyfill to your plugins in the .babelrc file:
{
"presets": [["es2016"]],
"plugins": ["syntax-async-functions","transform-regenerator","babel-polyfill"],
}
Upvotes: 1