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

Sentry v7 - Error in IE11 even after transpiling with babel #5184

Closed
3 tasks done
alexgibson opened this issue May 31, 2022 · 4 comments
Closed
3 tasks done

Sentry v7 - Error in IE11 even after transpiling with babel #5184

alexgibson opened this issue May 31, 2022 · 4 comments

Comments

@alexgibson
Copy link

alexgibson commented May 31, 2022

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/browser

SDK Version

7.0.0

Framework Version

No response

Link to Sentry event

No response

Steps to Reproduce

  1. Upgraded to Sentry 7.0.0
  2. Transpiled Sentry bundle from ES6 -> ES5 using Babel (v7.17.9)
  3. Loaded a page containing the Sentry JS bundle in Internet Explorer 11

Expected Result

The Sentry JS bundle should load without errors

Actual Result

IE11 throws an error SCRIPT1006: Expected ')'

Looking at the compiled result, it seems like there's a small portion of code that Babel fails to transpile correctly. Notice there are still some const, let variables, as well as some arrow functions that have not been caught.

let l;
(() =>{
  const {
    performance: t
  }
  = (0, r.R) ();
  if (t && t.now) {
    var e = 3600000,
    n = t.now(),
    i = Date.now(),
    s = t.timeOrigin ? Math.abs(t.timeOrigin + n - i) : e,
    o = s < e,
    a = t.timing && t.timing.navigationStart,
    c = 'number' == typeof a ? Math.abs(a + n - i) : e;
    return o || c < e ? s <= c ? (l = 'timeOrigin', t.timeOrigin) : (l = 'navigationStart', a) : (l = 'dateNow', i)
  }
  l = 'none'
}) ()

The rest of the transpiled code looks OK, as far as I can tell.

@AbhiPrasad
Copy link
Member

Hey, thanks for writing in! This is strange 🤔. The code that appears to be problematic here is a a IIFE we use in @sentry/utils in time.ts.

We just tested this and couldn't reproduce.

image

(used https://es6console.com/ + https://unpkg.com/@sentry/utils@7.0.0/esm/time.js )

Could you provide some kind of reproduction, or details about your setup (bundler usage etc.)?

@alexgibson
Copy link
Author

alexgibson commented May 31, 2022

Thanks for the quick reply!

Could you provide some kind of reproduction, or details about your setup (bundler usage etc.)?

We're using Webpack / Babel. Here's a link to our package.json for version dependencies: https://github.com/mozilla/bedrock/blob/main/package.json#L6

Here's a link to the PR where I'm testing things out mozilla/bedrock#11706

@alexgibson
Copy link
Author

Here's a link to our compiled output: https://www-demo1.allizom.org/media/js/sentry.js

@alexgibson
Copy link
Author

After some investigation I believe this is an issue with our project's config, not a Sentry issue. Thanks anyway!

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