import Map from "esri/Map";import MapView from "esri/views/MapView";import Graphic from "esri/Graphic";import GraphicsLayer from "esri/layers/GraphicsLayer";import webMercatorUtils from "esri/geometry/support/webMercatorUtils"; async function kewlClickHandler(event) { function initGo(); function initGo(Map, MapView, Graphic, GraphicsLayer, webMercatorUtils) { const map = view.map; var graphicsLayer = new GraphicsLayer(); // here map.add(graphicsLayer); ...... etc
No matter how I arrange my function params and header module includes; I repeatedly get the following error with my initDrawLine
function:
Uncaught (in promise) TypeError: GraphicsLayer is not a constructor
New to arcgis-js-api, any ideas?
Hi Cam, I don't see anything obvious in the code you shared. What version of the API are you working with? Could you share a simple codepen that reproduces this issue?
What happens if you change the imports to requires? E.g.:
const GraphicsLayer = require("esri/layers/GraphicsLayer");