Tim
Tim

Reputation: 3038

Configuring dojo loader paths

I'm having trouble with setting up dojo. Anything defined in the dojo config seems to correctly load using the localhost:8080/Scripts/foo.js path. However if I then try to load a module without this, say:

require(['foo'], function (_foo) { });

Then the client fails the request, with the attempted path being localhost:8080/foo.js. Obviously wrong.

What do I need to change?

// Configuration for the dojo AMD module loader
dojoConfig = {
   baseUrl: "/Scripts",
   packages: [{
      name: 'esri',
      location: 'esri'
   }, {
      name: 'dojo',
      location: 'dojo/dojo'
   }, {
      name: 'dojox',
      location: 'dojo/dojox'
   }, {
      name: 'dijit',
      location: 'dojo/dijit'
   }, {
      name: 'jquery',
      location: '.',
      main: 'jquery-2.0.2'
   },

Thanks.

Upvotes: 2

Views: 829

Answers (2)

C Snover
C Snover

Reputation: 18836

Either of these will solve your problem:

  1. Set dojoConfig.tlmSiblingOfDojo = false.
  2. Define 'foo' as a package with an explicit location.

Upvotes: 2

MiBrock
MiBrock

Reputation: 1100

Have a look at this link : http://dojotoolkit.org/documentation/tutorials/1.6/dojo_config/

Maybe the change from packages to modulePaths would help you.

Otherwise i would define the packages on the ordinary way :

<script src="//ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js"></script>

regards

Upvotes: 1

Related Questions