Skip to content

Instantly share code, notes, and snippets.

@Freeaqingme
Created February 16, 2013 21:08
Show Gist options
  • Save Freeaqingme/4968752 to your computer and use it in GitHub Desktop.
Save Freeaqingme/4968752 to your computer and use it in GitHub Desktop.
require({
// The base path for all packages and modules. If you don't provide this, baseUrl defaults to the directory
// that contains dojo.js. Since all packages are in the root, we just leave it blank. (If you change this, you
// will also need to update `app.profile.js`).
baseUrl: '/',
// A list of packages to register. Strictly speaking, you do not need to register any packages,
// but you can't require "app" and get app/main.js if you do not register the "app" package (the loader will look
// for a module at <baseUrl>/app.js instead). Unregistered packages also cannot use the `map` feature, which
// might be important to you if you need to relocate dependencies. TL;DR, register all your packages all the time:
// it will make your life easier.
packages: [
// If you are registering a package that has an identical name and location, you can just pass a string
// instead, and it will configure it using that string for both the "name" and "location" properties. Handy!
'dojo',
'dijit',
'dojox',
// Application Modules:
'application'
// For reference, this is what a more verbose package declaration looks like.
// { name: 'bootstrap', location: 'dojo-bootstrap', map: {} }
]
// Require `app`. This loads the main application module, `app/main`, since we registered the `app` package above.
}, [ 'application' ]);
Should be?
require({
// The base path for all packages and modules. If you don't provide this, baseUrl defaults to the directory
// that contains dojo.js. Since all packages are in the root, we just leave it blank. (If you change this, you
// will also need to update `app.profile.js`).
baseUrl: '/',
// A list of packages to register. Strictly speaking, you do not need to register any packages,
// but you can't require "app" and get app/main.js if you do not register the "app" package (the loader will look
// for a module at <baseUrl>/app.js instead). Unregistered packages also cannot use the `map` feature, which
// might be important to you if you need to relocate dependencies. TL;DR, register all your packages all the time:
// it will make your life easier.
packages: [
// If you are registering a package that has an identical name and location, you can just pass a string
// instead, and it will configure it using that string for both the "name" and "location" properties. Handy!
'dojo',
'dijit',
'dojox',
// Application Modules:
'application',
'module1',
'module2',
'module3',
'moduleN',
// For reference, this is what a more verbose package declaration looks like.
// { name: 'bootstrap', location: 'dojo-bootstrap', map: {} }
]
// Require `app`. This loads the main application module, `app/main`, since we registered the `app` package above.
}, [ 'application', 'module1', 'module2', 'module3', 'moduleN' ]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment