Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

babel-runtime and babel-polyfill should have option to not polyfill ES5 functionality (T7517) #4417

Closed
babel-bot opened this issue Jul 27, 2016 · 2 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@babel-bot
Copy link
Collaborator

Issue originally made by @taion

Bug information

  • Babel version: 6.11.4
  • Node version: 6.3.1
  • npm version: 3.10.3

Options

.babelrc:

{
  "plugins": ["transform-runtime"]
}

Input code

Object.create(a);

Description

The output code here is:

import _Object$create from "babel-runtime/core-js/object/create";
_Object$create(a);

babel-polyfill pulls in this polyfill as well, but it's harder to demonstrate.

Given that Babel assumes that code will run in an ES5 environment, it seems incorrect to ship polyfills for ES5 functionality by default.

This also applies somewhat to e.g. the much more commonly used Object.keys, where the difference between ES5 and ES2015 is relatively minor and unlikely to come up in practice.

@babel-bot
Copy link
Collaborator Author

Comment originally made by @taion

This is veering into feature request territory, but I think:

  • Babel polyfills should never include strict ES5 functionality like Object.create
  • Babel polyfills should expose a "loose" mode (option for babel-plugin-transform-runtime, maybe babel-polyfill/loose) that pragmatically omits polyfills for functionality like Object.keys where the specific ES2015 semantics are usually unnecessary

@hzoo
Copy link
Member

hzoo commented Oct 8, 2016

lets move this into #3934

@hzoo hzoo closed this as completed Oct 8, 2016
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 6, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

2 participants