AnsweredAssumed Answered

load custom modules in JSAPI 4.3

Question asked by DemersM on Mar 23, 2017
Latest reply on Mar 24, 2017 by thejus.kambi

Hi,

 

I am new to Dojo and ArcGIS JSAPI. I am using version 4.3 and I would like to load a custom module stored in a .js file in a subdirectory.

 

I was trying to do just as this example: http://servicesbeta.esri.com/demos/using-classes-with-javascript/seatgeek-search/ , but it does not work. Dojo is trying to load my custom module from http://js.arcgis.com/4.3/dojo/scripts/MspTiledMapServiceLayer.js instead of using location.pathname.replace(/\/[^/]+$/, "") + "/scripts"

 

<script src="https://js.arcgis.com/4.3/"></script>

<script>
    var dojoConfig = {
        paths: { scripts: location.pathname.replace(/\/[^/]+$/, "") + "/scripts" }
    };
    require(["scripts/MspTiledMapServiceLayer"], function(MspTiledMapServiceLayer) {

        new MspTiledMapServiceLayer();

   });

</script>

 

This returns a 404 error at http://js.arcgis.com/4.3/dojo/scripts/MspTiledMapServiceLayer.js

 

What am I doing wrong? Thanks a lot for your help.

 

Maxime

Outcomes