ember-cli / ember-cli-babel-polyfills

Split-build polyfills for evergreen and legacy browsers
MIT License
34 stars 6 forks source link

Build error with older @babel/preset-env versions #12

Closed Windvis closed 3 years ago

Windvis commented 4 years ago

I'm experimenting with this addon for the ember website redesign project and I noticed that building the app throws the following exception:

[BABEL] unknown: Invalid Option: corejs is not a valid top-level option.
Maybe you meant to use 'targets'? (While processing: "/mnt/c/Users/Windvis/Development/ember-website/node_modules/@babel/preset-env/lib/index.js")

npm ls @babel/preset-env shows the following output:

ember-website@0.0.0 /mnt/c/Users/Windvis/Development/ember-website
├─┬ ember-auto-import@1.5.3
│ └── @babel/preset-env@7.3.1
├─┬ ember-cli-babel@7.8.0
│ └── @babel/preset-env@7.3.1  deduped
├─┬ ember-leaflet@4.0.2
│ └─┬ ember-cli-babel@7.13.2
│   └── @babel/preset-env@7.8.3
└─┬ ember-styleguide@4.0.0-10
  └─┬ @ember/render-modifiers@1.0.2
    ├─┬ ember-cli-babel@7.14.1
    │ └── @babel/preset-env@7.8.4
    └─┬ ember-modifier-manager-polyfill@1.2.0
      └─┬ ember-cli-babel@7.14.1
        └── @babel/preset-env@7.8.4

Manually installing @babel/preset-env seems to fix the issue, (so I assume updating the transitive dependencies would do so as well).

Is there a reason why this addon doesn't list a specific version of @babel/preset-env as dependency? I think that would prevent this error, right?

pzuraq commented 4 years ago

ember-cli-babel includes its own version of babel + babel/preset-env. We can't override that, or tell it to change, so if there's an incompatibility there would be an issue. For instance, if we tried to use a preset-env that was more recent and required a more recent @babel/core.

At least, that was my logic. Maybe it would make sense to try to include our own and override ember-cli-babel somehow.

Windvis commented 4 years ago

Oh, I see. Maybe a note in the readme about the required versions would help? And some guidance on how to resolve it? I guess the real solution would be to bump ember-cli-babel itself then?