AnsweredAssumed Answered

System import error: Error: (SystemJS) esri_mods_1.Map is not a function

Question asked by mayildiz06 on Nov 16, 2016

Hi,

I want to import arcgis-js-api 3.18 in my project which created as Asp.Net Core empty project. I am using angular2 with typescript in my project. Also want to add and use arcgis-js-api 3.18 but i am having an error like "System import error: Error: (SystemJS) esri_mods_1.Map is not a function". The details at the below and please help me. I can use arcgis-js-api 4.1 version as successfuly but with 3.18 i am having trouble

 

I have already added "esriSystem.js" and "arcgis-js-api 3.18 version" referenced in my index.html

this is the my esri modules which are i am trying to load 

(function (window) {
window.esriLoadConfig = {
modules: [
'esri/map',
"esri/layers/MapImageLayer"
]
};
}(window))

 

i have olsa esri-mod.d.ts file and content of it at the below

/// <reference path="../../node_modules/@types/arcgis-js-api/index.d.ts" />
declare module "esri-mods" {
export import Map = require("esri/map");

export import MapImageLayer = require("esri/layers/MapImageLayer");
}

in my main.ts file i am using these modules like 

/// <reference path="../../typings/index.d.ts" />

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';

import { Map } from 'esri-mods';

const platform = platformBrowserDynamic();

platform.bootstrapModule(AppModule);

var mymap = new Map("map");//error

 

when i  build my project is succesfully. But at the run time i am getting the error when bold-italic line is being process

 

this is also error message in chrome console window

System import error: Error: (SystemJS) esri_mods_1.Map is not a function
TypeError: esri_mods_1.Map is not a function
at Object.eval (http://localhost:51032/app/main.js:8:13)
at eval (http://localhost:51032/app/main.js:13:4)
at eval (http://localhost:51032/app/main.js:14:3)
at eval (native)
Evaluating http://localhost:51032/app/main.js
Error loading http://localhost:51032/app/main.js

Outcomes