Skip to content
This repository has been archived by the owner on Dec 6, 2021. It is now read-only.

[feature] Override @babel/preset-env options like target browsers #476

Closed
alekbarszczewski opened this issue Aug 24, 2018 · 3 comments
Closed

Comments

@alekbarszczewski
Copy link

Do you want to request a feature or report a bug?

feature

What is the current behavior?

There is no way to set babel-preset-env targets - default is ie9 I think, but I would like to set other options regarding safari versions and so on. Right now, AFAIK, the only way is to write my own babel config and use it instead of babel-preset-poi. However it would be copy-pasting of this code: https://github.com/egoist/poi/blob/master/packages/babel-preset-poi/index.js.

What is the expected behavior?

Would be nice to be able to pass other options (in addition to "jsx" option) to babel-preset-poi to override @babel/preset-env options.

If this is a feature request, what is the motivation or use case for changing the behavior?

To have full control of @babel/preset-env options like "target" (browser versions).

Please mention other relevant information such as the browser version, Node.js version, Poi version and Operating System.

n/a

@throrin19
Copy link
Contributor

throrin19 commented Aug 24, 2018

Hi, It's possible with the .babelrc file. In my case, I use this config for the preset-env part :

{
    "presets": [
        "babel-preset-poi",
        ["@babel/preset-env", {
            "targets": {
              "browsers": [
                ">0.25%",
                "not ie 10",
                "not op_mini all"
              ]
            }
        }]
    ]
}

@alekbarszczewski
Copy link
Author

@throrin19 But to have plugins like class properties / decorators and so on you have to declare it in .babelrc on your own right? Generally to just change browser targets you have to copy this config https://github.com/egoist/poi/blob/master/packages/babel-preset-poi/index.js into your own .babelrc.js file - right?

Would be handy to just pass options instead of copy-pasting something that already exists.

@egoist egoist closed this as completed in 14be4e1 Oct 25, 2018
@lili21
Copy link

lili21 commented Nov 21, 2018

But to have plugins like class properties / decorators and so on you have to declare it in .babelrc on your own right

That's kind of weird. I don't think it the default behavior of babel.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants