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

Unknown version 59 of op_mob #537

Closed
mischnic opened this issue Sep 19, 2020 · 28 comments
Closed

Unknown version 59 of op_mob #537

mischnic opened this issue Sep 19, 2020 · 28 comments

Comments

@mischnic
Copy link

mischnic commented Sep 19, 2020

const browserslist = require("browserslist");

console.log(browserslist(["op_mob 59"], {mobileToDesktop: true}));

fails with

Uncaught Error [BrowserslistError]: Unknown version 59 of op_mob
    at Function.select (.../node_modules/browserslist/index.js:1101:17)
    at .../node_modules/browserslist/index.js:336:33
    at Array.reduce (<anonymous>)
    at resolve (.../node_modules/browserslist/index.js:318:18)
    at browserslist (.../node_modules/browserslist/index.js:443:21)
console.log(browserslist(browserslist(['op_mob 46']))); // == [ 'op_mob 46' ]
console.log(browserslist(browserslist(['op_mob 47']))); // Error

This has come up because Parcel first does browserslist(["> 0.25%"]) with the query read from some npm package.json, and then passing the result to Babel which calls browserslist again (parcel-bundler/parcel#5164 (comment))

@Natetronn
Copy link

Subscribed...

@ai
Copy link
Member

ai commented Sep 19, 2020

Do you have an idea how to solve the problem?

@mischnic
Copy link
Author

mischnic commented Sep 19, 2020

So when running browserslist without mobileToDesktop: true, data in this line just before the error

var data = checkName(name, context)

is:

{
  name: 'op_mob',
  versions: [
    '10',   '11',
    '11.1', '11.5',
    '12',   '12.1',
    '59'
  ],
  released: [
    '10',   '11',
    '11.1', '11.5',
    '12',   '12.1',
    '59'
  ],
  releaseDate: {
    '10': 1287100800,
    '11': 1300752000,
    '12': 1330300800,
    '59': 1593475200,
    '11.1': 1314835200,
    '11.5': 1318291200,
    '12.1': 1349740800
  }
}

With mobileToDesktop: false, all versions are there except 59, so

console.log(browserslist(["op_mob 46"], {mobileToDesktop: false})); // throws, expectedly?
console.log(browserslist(["op_mob 59"], {mobileToDesktop: false})); // doesn't throw, expectedly?
console.log(browserslist(["op_mob 59"], {mobileToDesktop: true})); // throws?

The description

mobileToDesktop: Use desktop browsers if Can I Use doesn’t have data about this mobile version

suggests that turning on that option should never produce more errors than before.


Maybe here

browserslist/index.js

Lines 253 to 258 in 7986f76

var cloned = cloneData(desktop)
cloned.name = name
if (name === 'op_mob') {
cloned = mapVersions(cloned, { '10.0-10.1': '10' })
}
return cloned

browserslist.data[name] should be somehow merged in as well (to get the use desktop browsers if not available effect)? Though I'm surprised that there is no Opera Desktop 59 in the first place....

@Natetronn
Copy link

Though I'm surprised that there is no Opera Desktop 59 in the first place....

There was one, unless you mean in the browserlist itself?

https://blogs.opera.com/desktop/2018/11/opera-developer-59-with-built-in-crypto-wallet-access/ - (many posts on it, in fact.)

@mischnic
Copy link
Author

unless you mean in the browserlist itself?

Yes, in the browserslist database

@ai
Copy link
Member

ai commented Sep 19, 2020

Browserslist uses Can I Use as a database. Can I Use doesn't have a separated data for mobile browser versions.

This option just cover desktop browser versions to mobile, assuming that they have the same features.

It is a hack. But Babel team needed it.

@Natetronn
Copy link

Natetronn commented Sep 19, 2020

Not sure if this is helpful or if there is something I can do to help?

https://help.opera.com/en/opera-version-history/
https://help.opera.com/en/operas-archived-history/

According to those archives, 59 was only a beta on desktop.

And looking at the Can I Use image below, appears to have been on Opera Mobile? Is that weird? (interesting, I guess it was a recent mobile version: https://blogs.opera.com/mobile/2020/06/opera-for-android-59/)

@Natetronn
Copy link

Natetronn commented Sep 19, 2020

Here's the Opera versions that's on Can I use:

Opera

https://caniuse.com/ciu/comparison

@scriptex
Copy link

scriptex commented Sep 20, 2020

Here is what I did in order to (temporarily) fix the issue:

  1. Deleted the .cache folder
  2. Added "not op_mob > 1" in the browserslist setting in my package.json file.
  3. Rebuilt the project

I am using parcel-bundler v.1.12.4

@mischnic
Copy link
Author

@ai

So from what I can tell, mobileToDesktop actually always uses the desktop version of the browser, not only if Can I Use doesn’t have data about this mobile version.

I think there are solutions:

@ai
Copy link
Member

ai commented Sep 20, 2020

change mobileToDesktop to somehow merge mobile & desktop (if that's even possible?)

Can I Use doesn’t have version data of mobile browsers? There is no database to merge with.

add Opera Desktop 59 to the Can I Use DB

I think this is the best solution since Can I Use data is not valid right now.

@mischnic
Copy link
Author

Can I Use doesn’t have version data of mobile browsers? There is no database to merge with.

At least on https://caniuse.com/ciu/comparison, I can see an "Opera Mobile" browser. The versions on that page are also in the snippet I posted here: #537 (comment) (op_mob).

I think this is the best solution since Can I Use data is not valid right now.

Do you know how to do this/who to ask?

@ai
Copy link
Member

ai commented Sep 20, 2020

At least on https://caniuse.com/ciu/comparison, I can see an "Opera Mobile" browser

I mean that Can I Use has no separated version for ach browser. For Opera Mobile they have only the latest version.

Do you know how to do this/who to ask?

Send PR to Can I Use and give me a link. I will support you in the PR.

@ai
Copy link
Member

ai commented Sep 20, 2020

@mischnic can you also try this PR for Browserslist 5.0? Did it fix this problem?

@mischnic
Copy link
Author

can you also try this PR for Browserslist 5.0? Did it fix this problem?

console.log(browserslist(["op_mob 59"], {mobileToDesktop: true})); still fails.

@mischnic
Copy link
Author

Send PR to Can I Use and give me a link. I will support you in the PR.

-> Fyrd/caniuse#5617

@ai
Copy link
Member

ai commented Sep 20, 2020

Opera 59 w never released. I will add a fix to mobileToDesktop.

@mischnic mischnic reopened this Sep 20, 2020
@eranroll
Copy link

Hi! Any updates?
I tried the workaround using “not op_mob 59” and it doesn’t work… so I’m kind off stuck on this one...

@AddictionRecovery
Copy link

AddictionRecovery commented Sep 21, 2020

I have nothing new to contribute here just wanted to confirm I am experiencing the same issue and none of the suggestions in this issue or here parcel-bundler/parcel#5164 have worked so far. Thanks to everyone who is actively working on a solution.

@codyrushing
Copy link

none of the solutions have worked for me either

@Natetronn
Copy link

Natetronn commented Sep 22, 2020

You deleted .parcel-cache, npm_modules, and package-lock.json (or yarn.lock), added the suggestions to your package.json?

Then ran npm install or yarn to reinstalled all the dependencies?

Using Yarn, this one worked for me:

"resolutions": {
  "browserslist": "4.14.2",
  "caniuse-lite": "1.0.30001129"
}

I used Parcel default for browserlist, which meant I didn't include a .browserlistrc or anything related to it in package.json i.e. no where did I include not op_mob 59.

I should add, I also removed Parcel using npm uninstall parcel and made sure browerlist wasn't installed anymore either, using npm ls to check if it was indeed removed (you can grep if need be.) Then I reinstalled it using yarn.

(if you wanted to use npm you'd do the same but, with the npm based suggestion from the other thread.)

@ai
Copy link
Member

ai commented Sep 22, 2020

Fixed 674b53a

@ai ai closed this as completed Sep 22, 2020
@ai
Copy link
Member

ai commented Sep 22, 2020

The fix was released in 4.14.4

@mischnic
Copy link
Author

Thank you!

@Natetronn
Copy link

Yes, thank you!

Really appreciate everyone taking this on and so quickly.

@skipjack
Copy link

skipjack commented Feb 28, 2021

Just ran into this error with another package, @ai's browserlist release note combined with bumping the caniuse-lite version from 1.0.30001129 to 1.0.30001192 in resolutions was the only thing that seemed to work...

  "resolutions": {
    "browserslist": "4.14.4",
    "caniuse-lite": "1.0.30001192"
  },

Confusing because the recommended npx browserslist@latest --update-db command kept yielding the error whenever I'd restart my parcel server. Anyway hope the above might help others and wondering if this is something specific to parcel. Ah, or maybe something weird with npm-force-resolutions, I should probably just upgrade parcel to v2 😁

@winnemucca
Copy link

@skipjack I got this using an angular project. Which configuration file did you add this fix to?

@skipjack
Copy link

skipjack commented Dec 3, 2021

The package.json file in combination with npm-force-resolutions...

https://www.npmjs.com/package/npm-force-resolutions

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

9 participants