Cascade of JavaScript errors caused if `window.global` is defined

XMLWordPrintable

    • Type: Bug
    • Resolution: Obsolete
    • Priority: Low
    • None
    • Affects Version/s: 7.0.0
    • Component/s: Front-end API
    • None
    • 7
    • 1
    • Severity 1 - Critical

      From https://community.developer.atlassian.com/t/project-settingss-sidebar-broken-jira-p2-and-react/20982.

      Jira's approach to registering the moment library does not work as expected if the babel-polyfill is present in the environment, since it creates the global variable. When this global variable is present, moment does not export itself to the AMD module that Jira expects it to, which can cause a cascade of JavaScript errors further down in the batch file that moment is included in. This, in turn, can cause cryptic errors like this one:

      Uncaught TypeError: Cannot set property ‘registerHotspotTour’ of undefined
      at hotspot-tour.js:18
      at hotspot-tour.js:232
      Uncaught Error: undefined missing jira/projects/sidebar/expansion-manager
      at l (batch.js:25)
      at batch.js:25
      batch.js:25 Uncaught Error: undefined missing jira/projects/sidebar/sidebar-placeholder-initializer
      at l (batch.js:25)
      at batch.js:25
      

      The code in Jira needs to be updated to avoid exporting to global when it is present, and guarantee that the library is available through the `jslibs/moment-2.6.0` AMD module it consumes.

            Assignee:
            Unassigned
            Reporter:
            Daz
            Votes:
            8 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: