I have an HTML page that uses the ArcGIS JavaScript API 3.19. I've also created a custom module which includes my own code. The files are organized as follows:
index.html
/js
SearchExtent.js
In my HTML file, I'm referencing both the ArcGIS JavaScript API and my custom JavaScript file as follows:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://js.arcgis.com/3.19/esri/css/esri.css">
<script src="https://js.arcgis.com/3.19/init.js"></script>
<script src="js/SearchExtent.js"></script>
<script>
require([
"js/SearchExtent",
...
When I load the web page, I'm getting a 404 error (reported in the console) that indicates that the following resource can't be found:
https://js.arcgis.com/3.19/js/SearchExtent.js
It appears as though the dojo loader is looking for my custom JavaScript file on js.arcgis.com. I've been led to believe that this is an issue with the dojo configuration.
When I attempt to configure dojo as per the dojo toolkit documentation to load both CDN and custom modules, like so:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://js.arcgis.com/3.19/esri/css/esri.css">
<script data-dojo-config="async: 1, dojoBlankHtmlUrl: '/blank.html',
packages: [ {
name: 'custom',
location: location.pathname.replace(/\/[^/]+$/, '') + '/js/custom'
} ]"
src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js"></script>
<script src="https://js.arcgis.com/3.19/init.js"></script>
<script src="js/SearchExtent.js"></script>
<script>
require([
"custom/SearchExtent",
"dojo/domReady!"
], function (SearchExtent) {
console.log("...");
});
</script>
</head>
<body>
</body>
</html>
The browser looks to be trying to load the ArcGIS JavaScript API from the Google CDN.
What's the correct way to configure dojo to use the ArcGIS JavaScript API and custom modules?