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

[Bug]: Opera mobile equated to Opera desktop in preset-env #15711

Closed
1 task
steverep opened this issue Jun 19, 2023 · 2 comments · Fixed by #15727
Closed
1 task

[Bug]: Opera mobile equated to Opera desktop in preset-env #15711

steverep opened this issue Jun 19, 2023 · 2 comments · Fixed by #15727
Assignees
Labels
i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@steverep
Copy link

💻

  • Would you like to work on a fix?

How are you using Babel?

babel-loader (webpack)

Input code

n/a

Configuration file name

babel.config.js

Configuration

{
  "targets": "defaults",
  "presets": ["@babel/preset-env"]
}

Current and expected behavior

When obtaining targets from browserslist, preset-env seems to select the Opera version based on the minimum of "opera" (Opera desktop) and "op_mob" (Opera mobile for Android). This is not appropriate as they have different release cycles and their version numbers are not in sync.

This similar scenario was recently fixed in browserslist version 4.21.9, so that a typical "defaults" query would return a valid op_mob version. However, because of Babel's current treatment, equating the two, a target of Opera 73 is selected (latest Opera for Android) instead of Opera 99 (Opera desktop latest). Since the compatibility data is based on Opera desktop, this causes unnecessary extra transpilation.

Please see browserslist/browserslist#766 (comment) for greater detail.

Environment

core/preset-env 7.22.5
browserslist 4.21.9

Possible solution

Short term fix would be to ignore op_mob in browserslist results.

Longer term, consider adding separate compatibility data for op_mob.

Additional context

No response

@babel-bot
Copy link
Collaborator

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

@steverep
Copy link
Author

The equivalency happens here:

Just deleting that would ignore it from browserslist I think, but it's not at all clear if that would have unintended side effects.

@JLHwung JLHwung self-assigned this Jun 27, 2023
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants