简体   繁体   中英

Dojo build package configuration

In our Dojo system, we have something like the following specified in our dojoConfig:

packages: [{
    name: "myWidgets",
    location: "/js/libs/widgets"
}]

So that in our require statements, all we have to do is something like:

 require(["myWidgets/myCalendarWidget"....

The problem is when I run the build, this dojoConfig is not available and I get numerous missing dependency errors because 'myWidgets' isn't defined according to the build profile.

Now, I've tried adding a package block to the build profile also, but the end result of that is to create an actual 'myWidgets' package, which I don't want.

So, is there any way to make the build see the definition of the 'myWidgets' alias, yet have the end result of the build output still mirror the regular file structure (ie /js/libs/widgets)? I tried to define these path aliases in the defaultConfig element in the build profile and that doesn't work either.

If you are using a profile, you can specify the packages in the profile

/util/buildscripts:./build.sh profile=../../../myProfile.js

http://dojotoolkit.org/reference-guide/1.8/build/buildSystem.html#profile-basics

You can also specify a javascript file that holds the dojoConfig

/util/buildscripts:./build.sh --dojoConfig ../build/examples/dojoConfig.js

http://dojotoolkit.org/reference-guide/1.8/build/buildSystem.html#using-a-package-configuration


Answer to your comment. The path is relative from where dojo.js is.

var dojoConfig = {
    parseOnLoad: true,
    isDebug: true,
    locale: 'en-us',
    paths: {
        "evf":      "../../evf"
    }
};

My directory structure looks like

js/dojo-1.8.0
  dijit
  dojo <-- contains dojo.js
  dojox
  util
js/evf
  myCustomWidget.js 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM