Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up@babel/preset-env adding unnecessary core-js polyfill #10758
Comments
This comment has been minimized.
This comment has been minimized.
Hey @serenader2014! 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." |
This comment has been minimized.
This comment has been minimized.
There are two questions here. The first one is why (function (window) {
window.location = /foo/;
window.location.search("foo");
})({}) so when Babel sees a pattern like The other question is why it is applied under If you have |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
That sounds weird to me. So how can I use |
Bug Report
Current Behavior
@babel/preset-env is adding unnecessary core-js polyfill, when setting @babel/preset-env 's target options to
chrome 49
, for a quite simple one line code :window.location.search
, babel will produce a useless core-js polyfill:The weird thing is, when changing the target browsers to
chrome 50
, the polyfill is gone. So why babel will produce thises6.regexp.search
polyfill for this code under chrome 50 version?Input Code
REPL link: https://babeljs.io/repl#?babili=false&browsers=chrome%2049&build=&builtIns=usage&spec=false&loose=false&code_lz=O4SwdgJg9sB0A2UDGBDALiKZYGcCmKATkgBYDcQA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env&prettier=false&targets=&version=7.7.4&externalPlugins=
Expected behavior/code
Base on the input from the REPL link, the result should not contain core-js polyfill.
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
babel.config.js
Environment
cli
,register
,loader
]Possible Solution
Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.