Cannot get require to work in IE

255
3
07-11-2019 08:07 AM
GregoryBologna
Occasional Contributor

Getting error in IE11. No error in other browsers.

For example, using a basic Esri sample below errors in IE.

Same issue in 4.12

Version 3.9 works in IE

// *************************************************
// API loaded in footer...
// https://js.arcgis.com/4.11/esri/css/main.css
// https://js.arcgis.com/4.11/
// *************************************************
function somefunc() {
  try {
    require(["esri/Map", "esri/views/MapView"], function(Map, MapView) {
        var map = new Map({
          basemap: "streets"
        });
        var view = new MapView({
          container: "mapViewer",
          map: map,
          zoom: 4,
          center: [15, 65] // longitude, latitude
        });
    });
  } catch (error) {
    console.log(error);
  }
}
// ****************************
// Error output to console
// ****************************
TypeError: [object Object] is not an object!
{
[functions]: ,
@@hasInstance: undefined,
@@isConcatSpreadable: undefined,
@@iterator: undefined,
@@match: undefined,
@@observable: undefined,
@@replace: undefined,
@@search: undefined,
@@species: undefined,
@@split: undefined,
@@toPrimitive: undefined,
@@toStringTag: undefined,
@@unscopables: undefined,
__proto__: { },
at Anonymous function (https://js.arcgis.com/4.11/?ver=4.11:429:211)
at K (https://js.arcgis.com/4.11/?ver=4.11:19:73)
at K (https://js.arcgis.com/4.11/?ver=4.11:18:398)
at K (https://js.arcgis.com/4.11/?ver=4.11:18:398)
at K (https://js.arcgis.com/4.11/?ver=4.11:18:398)
at K (https://js.arcgis.com/4.11/?ver=4.11:18:398)
at K (https://js.arcgis.com/4.11/?ver=4.11:18:398)",
Symbol()_g.hbfjhg26xy3: undefined
}
Tags (2)
0 Kudos
3 Replies
JackFairfield
Occasional Contributor II

Move your script tag to the header:

Example:

JS Bin - Collaborative JavaScript Debugging 

0 Kudos
GregoryBologna
Occasional Contributor

Thanks, but I am using wordpress and need esri to load as defered and in footer, otherwise it gets multipleDefined errors from jQuery. Chrome\Firefox\Opera\Edge all work as is. 

0 Kudos
GregoryBologna
Occasional Contributor

I found the issue. 

I am using pdf.js to generated PDF files in another part of my website, and unrelated to Esri. The map works when I remove the reference to pdf.js.

0 Kudos