website
website copied to clipboard
v7.4 for the browser : setup documentation for polyfills
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
for ( let [ i, point ] of points.entries() )
{ ... }
Expected behavior/code no js error
Babel Configuration (.babelrc, package.json, cli command)
{
"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
Hey @aavmurphy! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.
You can use the @babel/preset-env
's useBuiltIns
option if you are bundling your code; otherwise you'll need to manually import a polyfill (e.g. core-js-bundle
or es6-shim
+ es7-shim
)
@nicolo-ribaudo can I help in updating the doc ?. If I am not wrong, we need to update it here polyfill.md
Hey @aavmurphy! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.