Reputation: 3903
The tutorials got me going with the Dojo build system. However I'm left with a question that'll make or break the possibility of deploying a fully built release in my case. It is possible that the tutorial explains it, but that I didn't get it. Apologies if that was the case !
I use a library that lives inside an AMD layer ; let's call it blackboxLayer.js
. There are several packages inside that layer, but I suppose the question would be the same if there was only one. So let's say that blackboxLayer.js
contains a single package called blackbox
, with modules blackbox/A
and blackbox/B
. To be sure that things are fun, that layer is bootable. And of course it's closed source stuff.
My app modules reference blackbox/A
or blackbox/B
. How do I make my build profile go look for the blackbox
package inside that blackboxLayer.js
file, rather than in a directory ?
Thanks for any input. :)
Upvotes: 0
Views: 96
Reputation: 3903
The interim solution I've been using since this question has been posted is NOT to use dojo's builder... Instead I use a lightweight grunt pattern that concatenates AMD sources into a layer, and then I reference the layer from dojoConfig's deps
property. The concatenation process is visible here : https://github.com/gruntjs-updater/grunt-amd-concat
Upvotes: 0
Reputation: 91
If built file blackboxLayer.js is in relative path /release/blackbox/layers
, there is a separate dojo layer
<script type="text/javascript" src="path to dojoLayer.js"></script>
and
var dojoConfig = {
packages: [
{ name: 'blackbox', location: 'release/blackbox' }
]
};
then code inside this function can reference modules A and B,
require(['blackbox/layers/blackboxLayer'],
function () {
require(['dojo/parser', 'dojo/ready'],
function (parser, ready) {
ready(function () {
require(['blackbox/A', 'blackbox/B'],
function (blackboxA, blackboxB) {
// call blackboxA and blackboxB
});
});
});
});
If there is no separate dojo layer, you can reference blackboxLayer.js in the script tag, and omit the package def and requiring blackboxLayer.
Upvotes: 1