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

Docs: Specify @babel/present-env relations to common browsers such as Opera Mini #2482

Open
thernstig opened this issue Apr 12, 2021 · 6 comments

Comments

@thernstig
Copy link
Contributor

thernstig commented Apr 12, 2021

Feature Request

Is your feature request related to a problem?
https://babeljs.io/docs/en/babel-preset-env#how-does-it-work states that it follows https://github.com/babel/babel/blob/master/packages/babel-compat-data/data/plugins.json to know what plugins to pass to transpile code. https://babeljs.io/docs/en/babel-preset-env#browserslist-integration also recommends to use browerlist to specify targets.

But browserlist best practices https://github.com/browserslist/browserslist#best-practices states:

Opera Mini has 100 million users in Africa and it is more popular in the global market than Microsoft Edge. Chinese QQ Browsers has more market share than Firefox and desktop Safari combined.

It is thus confusing reading https://github.com/babel/babel/blob/master/packages/babel-compat-data/data/plugins.json and not seeing those browser there. Because if I run npx browserslist with defaults specified in .browserlistrc, I see many browsers (such as Opera Mini) not included in the plugins.json file. This means I assume it uses all plugins to transform my code.

Describe the solution you'd like
I would like the docs to be clear here how it works for all common browsers not listed in plugins.json. The current text makes it sound like all my code will use all plugins.

@babel-bot
Copy link
Contributor

Hey @thernstig! 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."

@JLHwung
Copy link
Contributor

JLHwung commented Apr 12, 2021

https://babeljs.io/docs/en/babel-preset-env#ineffective-browserslist-queries

We have a caveat section about Opera Mini and it applies to other browsers which do not have support data.

@nicolo-ribaudo nicolo-ribaudo transferred this issue from babel/babel Apr 12, 2021
@babel-bot
Copy link
Contributor

Hey @thernstig! 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.

@thernstig
Copy link
Contributor Author

@JLHwung thanks, I had not seen that one. As you mention, there are a lot of other browsers shown when doing npx browserlist with defaults configured.

But what does this mean then? That section does not make it clear for me. Will it as I suspect transpile all my code to use all plugins listed in https://github.com/babel/babel/blob/master/packages/babel-compat-data/data/plugins.json ?

Or what does "ignore" in that text actually mean?

@nicolo-ribaudo
Copy link
Member

"ignore" means that we specifying it has the same effect as not specifying it, we can try making the wording clearer on the website.

We could also explicitly write the list of "not ignored" browsers, which is basically the intersection of what browserslist supports and compat-table lists.

@thernstig
Copy link
Contributor Author

Thanks @nicolo-ribaudo - but it makes sense. I do think it would be a good thing to add more documentation about this, as there are quite many browsers that npx browserlist outputs that do not exist in the plugins.json.

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

4 participants