[Dojo-interest] Transitioning from scopeMap to packageMap

George Bochenek gbochenek at esri.com
Mon Apr 1 11:04:28 EDT 2013


Good Morning,

I'm having some issues assigning scope using the methods required by dojo 1.7+.

I have a local build running and want to load dojo for my custom modules from that build, but also load an API that bundles with dojo from a CDN.  In the past, I would load my version of dojo, assign a different scope map, and load the external API using esriDojo.require:

<script type='text/javascript'>
              djConfig = {
                     packages: [{
                           "name": "myPackage1",
                           "location": location.href.split("?")[0] + "js/myPackage1"
                     },
                     {
                           "name": "myPackage2",
                           "location": location.href.split("?")[0] + "js/myPackage2"
                     },
                     {
                           "name": "dwr",
                           "location": location.href.split("?")[0] + "dwr"
                     },
                  {"name":"dojo","location":location.href.split("?")[0] + "js/dojo"},
                  {"name":"dijit","location":location.href.split("?")[0] + "js/dijit"},
                  {"name":"dojox","location":location.href.split("?")[0] + "js/dojox"}
                     ],
                     xdWaitSeconds: 10,
                     dojoBlankHtmlUrl:"dojo/resources/blank.html"
              };

    </script>
              <script type="text/javascript" src="js/dojo/dojo.js"></script>
       <script type="text/javascript">djConfig={scopeMap:[[ "dojo","esriDojo" ],[ "dijit", "esriDijit" ],[ "dojox", "esriDojox" ]]};</script>


    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/"></script>


<script type="text/javascript">
    var config;

       dojo.ready(function(){

                esriDojo.ready(function(){

I know that scopeMap is deprecated in 1.7, so that method will no longer work, but I've tried replacing the scopeMap section of the loading scripts with:

<script type="text/javascript">
                var dojoMap = { dojo: "esriDojo", dijit: "esriDijit", dojox: "esriDojox" };
                djConfig = {
                                packages: [
                                                {
                                                                "name": "esriDojo",
                                                                "packageMap": dojoMap
                                                },
                                                {
                                                                "name": "esriDijit",
                                                                "packageMap": dojoMap
                                                },
                                                {
                                                                "name": "esriDojox",
                                                                "packageMap": dojoMap
                                                },
                                                {
                                                                "name": "esri",
                                                                "packageMap": dojoMap
                                                }
                                ]
                }

                </script>

As well as some other variations, with no luck.  Is there a recommended way to do this now, or is it not possible with newer versions?


Thank you,
George Bochenek

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20130401/f73b172b/attachment-0001.htm 


More information about the Dojo-interest mailing list