Starter app to build ArcGIS JS API with Vite and Typescript
Simple with the IDE in the web:
or locally with the following steps:
- Clone the repository
- Remove .git folder to untrack git
- Install dependencies with
npm install
- Start server with
npm run dev
and start programming
Steps to create this starter project:
-
npm create vite@latest
- set project-name
arcgisjsapi-vite-ts-starter
- select
vanille
- select
typescript
- set project-name
-
npm install
-
npm install @arcgis/core
to install ArcGIS JS API -
Change the
main.ts
to:import './style.css' import SceneView from "@arcgis/core/views/SceneView"; import Map from "@arcgis/core/Map"; new SceneView({ container: "viewDiv", map: new Map({ basemap: "topo-vector", ground: "world-elevation" }) });
-
Change in the
index.html
:<div id="app">
with<div id="viewDiv">
-
Change the
style.css
to:@import url("https://js.arcgis.com/4.28/@arcgis/core/assets/esri/themes/light/main.css"); html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; }
-
start with
npm run dev