0

I have the following AMD config for my project :

var amdconfig = {
  baseUrl: __AMD_CONFIG_BASE_URL__,
  packages: [
    {name: "loader", location: "./samples/lib/requirejs"},
    {name: "dojo", location: "./samples/lib/dojo"},
    {name: "dojox", location: "./samples/lib/dojox"},
    {name: "dijit", location: "./samples/lib/dijit"},
    {name: "luciad", location: "./luciad"},
    {name: "samples", location: "./samples"}
  ],
  cache: {},
  paths: {
    jquery: "./samples/lib/jquery/jquery-1.12.4",
    d3: "./samples/lib/d3/d3",
    bloodhound: "./samples/lib/typeahead/bloodhound",
    typeahead: "./samples/lib/typeahead/typeahead.jquery"
  }
};

For the Dojo build system, I have the following config :

var profile = {
  basePath: __AMD_CONFIG_BASE_URL__,
  releaseDir: "release",
  action: "release",
  stripConsole: "all",
  optimize: "closure",
  layerOptimize: "closure",
  selectorEngine: "acme",
  async: 1,
  packages: [{
    name: "loader",
    location: "./samples/lib/requirejs",
    destLocation: "./samples/lib/requirejs"
  }, {
    name: "dojo",
    location: "./samples/lib/dojo",
    destLocation: "./samples/lib/dojo"
  }, {
    name: "dijit",
    location: "./samples/lib/dijit",
    destLocation: "./samples/lib/dijit"
  }, {
    name: "dojox",
    location: "./samples/lib/dojox",
    destLocation: "./samples/lib/dojox"
  }, {
    name: "luciad",
    location: "../../main/javascript/luciad",
    destLocation: "./luciad"
  }, {
    name: "samples",
    location: "./samples",
    destLocation: "./samples"
  }],
  paths: {
    jquery: "./samples/lib/jquery/jquery-1.12.4",
    d3: "./samples/lib/d3/d3",
    bloodhound: "./samples/lib/typeahead/bloodhound",
    typeahead: "./samples/lib/typeahead/typeahead.jquery"
  },
  layers: {
    "samples/lib/requirejs": {
      include: [
        "samples/lib/requirejs"
      ],
      boot: true
    }
  }
};

Unfortunately, the Dojo Build System doesn't seem to know what to do with the paths :

error(311) Missing dependency. module: samples/trajectories/main; dependency: bloodhound
error(311) Missing dependency. module: samples/trajectories/TimeChart; dependency: d3
error(311) Missing dependency. module: samples/trajectories/TimeChart; dependency: jquery
error(311) Missing dependency. module: samples/trajectories/TypeaheadFilter; dependency: jquery
error(311) Missing dependency. module: samples/trajectories/TypeaheadFilter; dependency: bloodhound
error(311) Missing dependency. module: samples/trajectories/TypeaheadFilter; dependency: typeahead

How can I fix this?

I tried using the files property instead, but I couldn't get that to work either :

...
  files: [
    ["jquery", "./samples/lib/jquery/jquery-1.12.4.js"],
    ["d3", "./samples/lib/d3/d3.js"],
    ["bloodhound", "./samples/lib/typeahead/bloodhound.js"],
    ["typeahead", "./samples/lib/typeahead/typeahead.jquery.js"]
  ],
...

I tried defining them as packages, but that didn't work either :

...
{
    name: "jquery",
    location: "./samples/lib/jquery",
    destLocation: "./samples/lib/jquery",
    main: "jquery-1.12.4"
  }, {
    name: "d3",
    location: "./samples/lib/d3",
    destLocation: "./samples/lib/d3",
    main: "d3"
  }, {
    name: "bloodhound",
    location: "./samples/lib/typeahead",
    destLocation: "./samples/lib/typeahead",
    main: "bloodhound"
  }, {
    name: "typeahead",
    location: "./samples/lib/typeahead",
    destLocation: "./samples/lib/typeahead",
    main: "typeahead.jquery"
  }
...

What am I missing?

I'm using version 1.10.4 of dojo-util.

John Slegers
  • 45,213
  • 22
  • 199
  • 169

1 Answers1

0

I was having the same problem. From the Dojo Build Documentation:

Use the --dojoConfig command-line flag to point to a script that contains a dojoConfig object with package configuration data

It is unclear, but this could be taken as the build profiles only use the package information, ignoring the paths variable.

Thankfully I found this article which explains how to use the map object in the build profile, which acts similarly to the paths variable in dojoConfig.

So in your situation if you were to add

"map": {
  "*": {
    "jquery": "./samples/lib/jquery/jquery-1.12.4",
    "d3": "./samples/lib/d3/d3",
    "bloodhound": "./samples/lib/typeahead/bloodhound",
    "typeahead": "./samples/lib/typeahead/typeahead.jquery"
  }
}

to your build profile and leave the paths in dojoConfig, things should work.

Not sure if this is the most elegant solution due to the duped configuration of "map" and "paths", so if anyone has a better solution please respond!

MotoTK
  • 1