Hi I'm using Angular 11, Esri Javascript api 4.18 with the ESRI loader. I'm getting the subject error at runtime when I try to create a new 'esri/geometry/SpatialReference' object. Wierdly, Intellisense recognizes the Spatial Reference Object before I run the code. I'm also able to create the Map and MapView objects without problems.
Any idea why this is happening? I'm attempting to define the Spatial Reference inside the ngOnInit method within the code that gets called after the esri loader loads the ESRI modules -- same place as where the Map and MapView get created.
Thanks
Pete
The ngOnInit method is below:
Solved! Go to Solution.
I switched to ES Modules and the code is running fine. Maybe something in my project configuration was causing ESRI loader not to work.
Pete
@PeteVitt use the normal API pattern for initializing a new SpatialReference:
const sr = new SpatialReference({
wkid: 3857
});
When I changed the code I get a compile error: "Module not found: Error: Can't resolve 'esri/geometry'"
I switched to ES Modules and the code is running fine. Maybe something in my project configuration was causing ESRI loader not to work.
Pete