plugin-transform-runtime doesn't honor preset-env targets when corejs option is set #9363
Labels
i: bug
i: needs triage
outdated
A closed issue/PR that is archived due to age. Recommended to make a new issue
Bug Report
I've observed that plugin-transform-runtime does not conditionally transform a feature based on preset-env's configured targets when the corejs option is set. The specific example I ran into was when using
Object.entries
, which is supported on Node 8, but not supported on Node 6.Current Behavior
When preset-env is configured with
{ targets: { node: 6 }, useBuiltIns: 'usage' }
, then anObject.entires
polyfill is included in the transpiled output. If the node version is changed to 8, then this polyfill is no longer included. If plugin-transform-runtime is configured with{ corejs: 2 }
, then corejs'sObject.entries
implementation is included in the transpiled output when the node version is set to 6 or 8.Input Code
See https://repl.it/@blicksky/babel-transform-runtime-tests for a set of test cases that reproduces this scenario.
Expected behavior/code
When preset-env is configured with
{ targets: { node: 8 }, useBuiltIns: 'usage' }
and plugin-transform-runtime is configured with{ corejs: 2 }
, then usages ofObject.entries
in the input code should not be replaced with corejs's implementation in the transpiled output.Babel Configuration (.babelrc, package.json, cli command)
Environment
The text was updated successfully, but these errors were encountered: