How can I use the arcgis 3.x api and supporting files in an offline mode.

293
3
10-05-2017 12:08 PM
DannyVenier
New Contributor II

Client has heavy restrictions on internet access, so I would like to load all scripts into project rather than referencing them from CDNs (for example sdk is at https://js.arcgis.com/3.22).  However, the js and css (esri.css for example) files all contain many references to online font files, icon files etc. Is there a loading option that lets me use all (project) local scripts and css without embedded cdn references (normally would use Npm and dependencies are loaded)

There is the bower option but the docs seem out of date.  Bower build doesn't give an esri folder per the documentation, yet there's a arcgis-js-api component.  However the arcgis-js-api folder doesn't appear to contain the main arcgis api script file.  Not a great readme to describe how to use the bower option?

Has anyone used the bower "custom build" option successfully?

0 Kudos
3 Replies
ThomasSolow
Regular Contributor

My feeling is that you can download your preferred version of the API and host it yourself.  I don't think the API should have any external dependencies if you do this.

Of course a lot of defaults do point to ArcGIS Online, for example basemaps.

DannyVenier
New Contributor II

thanks for the input Thomas. 

I've tried just loading the script at the endpoint https://js.arcgis.com/3.22/ into my project and referencing it there.  However, there does seem to be some internal hooks in there - seems to be a connection to dojotoolkit.  And the required css files (esri.css for sure) point to fastfonts links in a cdn somewhere.

I simply want to replace what works in a script link <script src="https://js.arcgis.com/3.22/"></script> with something local.  Most packages would have an npm registered repo which gets all the dependencies and uses relative urls to those dependencies inside a local folder....and a readme that instructs me how to load the main script.  Is there a scenario with the dojo loader that does that (through bower)?

0 Kudos
ThomasSolow
Regular Contributor

I haven't used bower or npm to get the API, I would recommend just downloading the source from here and following the instructions in the readme.

0 Kudos