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/preset-env options ignored #5125

Closed
hackedd opened this issue Sep 10, 2020 · 1 comment
Closed

@babel/preset-env options ignored #5125

hackedd opened this issue Sep 10, 2020 · 1 comment

Comments

@hackedd
Copy link

hackedd commented Sep 10, 2020

🐛 bug report

I'm trying to compile some code and automatically add polyfills for IE11. To do this, I'd like to use @babel/preset-env with the useBuiltIns option set to usage, so I don't have to manually specify which polyfills to load. However, this option (and others) are never passed to Babel when I run Parcel.

🎛 Configuration (.babelrc, package.json, cli command)

src/test-endswith.js:

console.log(String.prototype.endsWith)
console.log("something".endsWith("thing"))

.babelrc:

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "debug": true,
        "useBuiltIns": "usage",
        "corejs": 3
      }
    ]
  ]
}

package.json:

  "browserslist": [
    "last 2 versions",
    "> 0.25%",
    "not dead",
    "ie >= 11"
  ],

🤔 Expected Behavior

I expect to see debug output from @babel/preset-env, and I expect a polyfill for String.endsWith.

...
Using polyfills with `usage` option:

[.../src/test-endswith.js] Added following core-js polyfill:
  es.string.ends-with { "chrome":"49", "edge":"17", "ie":"11", "safari":"5.1" }

...

😯 Current Behavior

The debug output is not displayed, and the polyfill is not included.

💁 Possible Solution

It looks like env presets are removed completely from the loaded config, maybe the options could be merged instead?

🔦 Context

💻 Code Sample

https://gist.github.com/hackedd/c4aa9368d542e75ea9186a59b2d2a1d9

🌍 Your Environment

Software Version(s)
Parcel 1.12.4
Node 12.18.2
npm/Yarn 6.14.8
Operating System
@mischnic
Copy link
Member

Duplicate of #3216

@mischnic mischnic marked this as a duplicate of #3216 Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants