babel / babel/website

v7.4 for the browser : setup documentation for polyfills

Open
#2,297 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
777
Forks
1.4k
Avg merge
16h 45m
Merged PRs (30d)
3

Description

## Bug Report

**Current Behavior**
Not sure if this is unclear documentation, or a bug.

- Using Babel (cli) for a website.
- One of the targets is IE11, which does not have (for ... of) and array.prototype.entries
- Used the 'setup' page, 'cli' option (aside: in step 3, the devdependency for cli has the wrong version)

Output is minimised by uglifyjs

The transpiling is all good.

But the js fails in IE11, the array.entries() calls.

Checking the output code, there is no entries() polyfill

Checked the polyfill page. It says the polyfill module is now depreciated.

Either the the setup page / documentation
- doesn't say how to include the polyfills lib, maybe: https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.4.4/polyfill.min.js
- or what config options to inject just the required polyfills into the output-code.

**Input Code**
```js
for ( let [ i, point ] of points.entries() )
{ ... }
```

**Expected behavior/code**
no js error

**Babel Configuration (.babelrc, package.json, cli command)**

```js
{
"presets": [
["@babel/preset-env", { "targets":"ie 11" } ]
]
}

```

**Environment**
- Babel version(s): 7.4
- Node/npm version: 8.10/3.5.2
- OS: ubuntu
- Monorepo: ?
- How you are using Babel: cli

**Possible Solution**
update documentation

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.