Bug Report
Current Behavior
Upon transpiling a file of code with async function, babel generates the following line:
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(// ...
regeneratorRuntime is undefined by default, from my research I found that you need to add a babel-polyfill for it to be defined:
import 'babel-polyfill';
async function test() {
// ...
}
However in a transpiled code, call to require('babel-polyfill'); goes after the call to regeneratorRuntime, thus regeneratorRuntime is still undefined. If I manually move require('babel-polyfill'); to the top of the transpiled file, code works as expected.
Input Code
Link to an example
Expected behavior/code
Call to require('babel-polyfill'); in transpiled code precedes the first call to regeneratorRuntime
Babel Configuration (.babelrc, package.json, cli command)
"scripts": {
"build": "babel ./ --ignore node_modules,dist -s -D -d dist --presets env"
}
Environment
- Babel version(s):
cli: 6.26.0, core: 6.26.3
- Node/npm version: Node 8.11.3, npm 5.6.0
- OS: Windows 10
Bug Report
Current Behavior
Upon transpiling a file of code with async function, babel generates the following line:
regeneratorRuntimeis undefined by default, from my research I found that you need to add ababel-polyfillfor it to be defined:However in a transpiled code, call to
require('babel-polyfill');goes after the call toregeneratorRuntime, thusregeneratorRuntimeis still undefined. If I manually moverequire('babel-polyfill');to the top of the transpiled file, code works as expected.Input Code
Link to an example
Expected behavior/code
Call to
require('babel-polyfill');in transpiled code precedes the first call toregeneratorRuntimeBabel Configuration (.babelrc, package.json, cli command)
Environment
cli: 6.26.0,core: 6.26.3