browserlist Firefox >= 52 adds regeneratorRuntime also if async is supported
- Dominant language
- TypeScript
- Stars
- 44k
- Forks
- 6k
- Avg merge
- 5d 15h
- Merged PRs (30d)
- 23
Description
## Bug Report
With browserlist `Firefox >= 52` and using async functions, babel adds regeneratorRuntime also if this version of firefox supports [async functions](https://caniuse.com/async-functions).
Adding `Firefox >= 53` fixes this issue.
**Current behavior**
Babel polyfills async functions with regeneratorRuntime and the browser gives error if you don't include regeneratorRuntime: `Uncaught ReferenceError: regeneratorRuntime is not defined`
**Input Code**
In .browserslistrc
```
Firefox >= 52
```
In js:
```
const accessEvent = async () => {
}
accessEvent()
```
**Expected behavior**
Babel should not polyfill with this browserlist.
**Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)**
- Filename: `babel.config.js`
```js
module.exports = {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'entry',
corejs: 3,
},
],
],
}
```
**Environment**
```
System:
OS: macOS 11.2.2
Binaries:
Node: 14.15.5 - /usr/local/bin/node
Yarn: 1.3.2 - /usr/local/bin/yarn
npm: 6.14.11 - /usr/local/bin/npm
npmPackages:
@babel/core: ^7.13.10 => 7.13.10
@babel/preset-env: ^7.13.10 => 7.13.10
babel-loader: ^8.2.2 => 8.2.2
webpack: 5.26.1 => 5.26.1
```
- Babel version(s): 7.13.10
- Node/npm version: v14.15.5
- How you are using Babel: webpack
Contributor guide
Research direction
Reproduce the case using .browserslistrc with Firefox >= 52, babel.config.js, and the async-function input. Trace how @babel/preset-env resolves this browser target and decides whether to transform async functions; done means the generated output no longer requires regeneratorRuntime for supported Firefox versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100