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

v2.5.0 throws Super expression must either be null or a function #335

Closed
newsiberian opened this issue Jul 17, 2019 · 9 comments
Closed

Comments

@newsiberian
Copy link

newsiberian commented Jul 17, 2019

It throws in production (development works as expected) at linux chromium, windows chrome (latest

Screenshot_20190717_160533

Here is how we use it:

import bowser from 'bowser';

export default function() {
  const ua = navigator.userAgent;
  const browser = bowser.getParser(ua);
  let flag;

  if (browser.satisfies({ chrome: '>=0', chromium: '>=0' })) flag = 'chrome';
  else if (browser.satisfies({ firefox: '>=0' })) flag = 'firefox';
  else if (browser.satisfies({ safari: '>=0' })) flag = 'safari';
  else if (browser.satisfies({ opera: '>=0' })) flag = 'opera';
  else if (browser.satisfies({ 'microsoft edge': '>=0' })) flag = 'edge';
  else flag = 'unknown';

  return {
    flag,
    name: browser.getBrowserName(),
    version: browser.getBrowserVersion(),
  };
}
@lancedikson
Copy link
Collaborator

Wow, that's weird. May it be so, that your production-building stage is somehow affecting the bowser code? I'd recommend first switching back to 2.4.0 for the production. We should try to reproduce it in repl.it or somewhere else.
What is the exact ua at that moment? Is it valid? Just to make sure that the reason is in the code, not in the arguments.

@newsiberian
Copy link
Author

Mine is "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36", but the same happens in FF and Windows Chrome

@eimanip
Copy link

eimanip commented Jul 17, 2019

Same here, using it in an Angular 8 project.

@newsiberian
Copy link
Author

newsiberian commented Jul 17, 2019

mediasoup-client has bowser as dependency and it use it like "^2.4.0".
Temporary yarn-fix for guys, who use it:

"resolutions": {   
  "mediasoup-client/bowser": "2.4.0"
},

@lancedikson
Copy link
Collaborator

Ok, I'm preparing the patch version with a fix reverting that Error class. 2.5.1 will be ready in a few minutes.

@lancedikson
Copy link
Collaborator

lancedikson commented Jul 17, 2019

It's available as 2.5.1. Try it out, please. It should fix the bug. Terribly sorry for any inconvenience. I'll make sure the next time we have tests for such case and don't break production.

@newsiberian
Copy link
Author

@lancedikson? after update to 2.5.1 I now receive bowser.getParser is not a function is that ok?

@lancedikson
Copy link
Collaborator

No, it's not. Thanks for the heads-up. Fixed it as 2.5.2. Now should be fine.

@lancedikson
Copy link
Collaborator

Long story short: we were trying to reduce the build size and I changed the modules system that Babel uses for the build from umd to auto and we hadn't had tests for it (but actually should have). So, it broke the build. Now I switched from auto to cjs, which works and still a bit less, than umd option.

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

3 participants