AnsweredAssumed Answered

Boilerplate with CDN - How?

Question asked by MattPil29 on Jun 19, 2013
Latest reply on Jun 21, 2013 by MattPil29
Hi,

I am trying to use the dojo boilerplate approach to using packages\modules.  I have this working on one site using a downloaded version of the API.  On my next site I want to use a CDN.  Here is what I have:

MapPage.html:
 
<div id="map" style="width: 400px; height: 400px;" />   <script src="//ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.js"              async="async"              data-dojo-config="async: true, tlmSiblingOfDojo: 0, baseUrl: 'Mapping', isDebug: true, deps:['Mapping/run.js']" ></script>

run.js
require({     packages: [         { name: 'esri', location: 'http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.3' },         'Viewer' ] , ['Viewer']);


Viewer\main.js
define(['require' ], function (require) {          require(["dijit/layout/BorderContainer", "dijit/layout/ContentPane", "esri/map"],     function(BorderContainer, ContentPane, esriMap) {          var map = new esriMap("map", {});      }) });


In the network panel of IE9 I can see bits of dojo loading ok, i.e.
http://ajax.googleapis.com/ajax/libs/dojo/1.8.0/dijit//layout/BorderContainer.js


But the request for esri/map is translated to this request:
http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.3/map.js


which returns success but with this response:
Could not find a part of the path 'C:\inetpub\wwwroot\jsapi\arcgis\3.3\map.js\init.js'.

This means that when I debug Viewer\main.js I can see the esriMap variable has not loaded the map code but instead returns the number 3.  Can anyone see where I have gone wrong?

Thanks, Matthew

Outcomes