question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Possibly broken in IE11

See original GitHub issue

I noticed that JSBI is broken in a test application when running in IE11.

When I exclude JSBI in webpacks babel-loader exclude (jsbi is parsed like the rest of my code):

grafik This possibly points to:

if (!_(t) || i(t) !== t) throw new RangeError("The number " + t + " cannot be converted to BigInt because it is not an integer");

I use core-js@3 and regenerator-runtime as polyfills. Maybe I need something else as well?

When I do not exlude JSBI and treat it like any other dependency (jsbi is included in babel-loader): grafik This time it is unfortunately absolutely impossible to tell what upsets poor IE. Maybe its the same statement, who knows 🤷‍♂️.

Is the UMD version tested? Works fine in Firefox 80, but not in IE11.

I also noticed https://github.com/GoogleChromeLabs/jsbi/issues/42. I tested importing the common-js and mjs versions directly, however I still get similar results. IE is broken while Firefox works.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
glr0221commented, Sep 10, 2020

I just wanted to say, I have successfully used JSBI with IE. Thank you so much @jakobkummerow @mathiasbynens @Miladiir

3reactions
jakobkummerowcommented, Sep 7, 2020

Looks like IE11 doesn’t support Math.imul and Math.clz32, which JSBI uses. At least, that’s the result I get when I comment out “minify()” in rollup.config.js, regenerate the UMD version, and test var a = JSBI.BigInt('12345678901234567890') with that on an IE11 VM.

As a short-term workaround, you can provide a very simple polyfill (which does not have the proper semantics, but is good enough for JSBI):

if (!Math.imul) {
  Math.imul = function(a, b) {
    return ((a & 0xFFFF) * (b & 0xFFFF)) | 0;
  }
}
if (!Math.clz32) {
  Math.clz32 = function(x) {
    if (x === 0) return 32;
    return 31 - (Math.log(x >>> 0) / Math.LN2 | 0) | 0;
  }
}

If you’re worried about breaking other modules that might want to use these functions, you can find functionally fully correct polyfills on MDN.

I know next to nothing about Babel. Presumably it has a way to polyfill Math functions, but I don’t know how to make it do that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Install problems with Internet Explorer 11 - Microsoft Learn
Most Internet Explorer 11 installations are straightforward and work the way they should. But it's possible that you might have problems.
Read more >
How to discover broken html/javascript in IE11? [closed]
1 Answer 1 · In case of JS features, sometimes the presence of some property on window object or other standard object, some...
Read more >
Web page layout broken issue due to "Natural Metrics" in IE11
After upgrading to IE11, web page layout may be broken. The most common reason is the web page runs in a newer document...
Read more >
IE11's developer tools are broken - windows 10 - Super User
IE11 is only required because developers are too lazy, too incompetent or the company is too cheap to fix the problem. There is...
Read more >
Recaptcha not working on Internet Explorer 11. - Google Groups
Just reset IE back to default for everything. Likely related to a toolbar or other add-in. Tools >> Internet Options >> Advanced tab...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found