Include @arcgis/core js scripts and assets in Angular build

112
4
08-15-2022 08:07 AM
JulianaCastillo
New Contributor

I'm creating an application that may not have access to the internet and need to load the ArcGIS Javascript 4.23 API from a local server. 

I'm currently using ES modules and can't seem to find a way to make sure the modules are part of the deployment. 

Any pointers on how to do this? I've seen posts on how to import assets but not full js library folders like  @arcgis/core

0 Kudos
4 Replies
AndyGup
Esri Regular Contributor

Hi @JulianaCastillo

1) Any service you are using, such as map tiles, feature services, etc. have to point to an ArcGIS Enterprise instance.

2) If you can't reach the public NPM repository to install "@arcgis/core" can download the tarball and then run "npm install ./path_to_tarball.tgz" in your project. To get the download location of the latest tarball run "npm view @arcgis/core dist" in a terminal window.

3) Configure the JS API assets to run locally: https://developers.arcgis.com/javascript/latest/es-modules/#managing-assets-locally. For Angular, there are specific instructions in the NPM readme: https://www.npmjs.com/package/@arcgis/core.

4) Download the SDK documentation for local use. To download the documentation, navigate to the ArcGIS API for JavaScript download page and log-in with your Esri global account. If you are using @arcgis/core you won't need to use the AMD modules.

0 Kudos
JulianaCastillo
New Contributor

Thank you, 

So for the js scripts, I'd have to use AMD if I need to run them locally? 

I have been using ES modules through my application and I'd need to re-create to use AMD? 

Juliana

0 Kudos
AndyGup
Esri Regular Contributor

@JulianaCastillono you can continue using @arcgis/core as outlined in my steps above. I'm not sure what gave you that impression? Maybe #4 above was confusing because of the link I used, I'll update that information to help clarify.

We recommend downloading the JS API documentation for use offline - the JS API documentation applies to both AMD and ESM, the API functionality is the same. To download the documentation, navigate to the ArcGIS API for JavaScript download page and log-in with your Esri global account. If you are using @arcgis/core you won't need to download or use the AMD modules.

Did that help?

0 Kudos
JulianaCastillo
New Contributor

It did help somewhat but now I'm getting other issues. 

My hover popups are not displaying as well as the home widget with the zoom in/out. 

It does not show any errors but are not displaying. Is there anything else I might be missing?

UPDATE: The main.css file was not loading. I moved it out back to the angular.json file and it seems to be working fine.

Thanks, 

Juliana

0 Kudos