main.js
requirejs.config({
    baseUrl: ‘scripts/lib‘, 
    paths: {
            app: ‘../app‘, 
            style:‘../../style‘, 
            resources:‘../../resources‘, 
            css:‘require-css/css‘, 
            jquery: ‘jquery‘,
            formBootstrap:‘formValidation/dist/js/framework/bootstrap‘, 
            formvalidation:‘formValidation/dist/js/formValidation‘,
iCheck:‘icheck/icheck‘,
text:‘require-text/text‘
    }, 
    shim : { 
            formvalidation : { 
                deps : [ ‘jquery‘] 
            }, 
            formBootstrap:{ 
                deps: [‘formvalidation‘] 
            }, 
            iCheck: [ ‘jquery‘] 
    }, 
    map: {}
});
baseUrl: configure loading modules form that directory.
把所有的第三方依赖,如jQuery, 放在lib文件夹下。baseUrl被设置为lib,requireJS会基于这个目录来寻找依赖的模块。如果不设置,baseUrl默认为data-main指定的文件(在html中指定)所在的路径。
paths:  the paths config is only for setting up root paths for module IDs . paths配置仅用于设置对应模块ID的根路径 
-    app:‘../app‘
    声明依赖 require(["app/common"].. 的时候,其实是在寻找 ../app/common.js。
- text:‘require-text/text‘
    对于插件,如text,有以下说法:如写在 map:*中,无法在Node下顺利加载。
- 有说法,不是以paths中声明的项目开头的路径,不受影响。但在实际使用中,依然会被代换。
    比如,require(["../../app/common"],其中的 app 会被代换为 ../app  
map:  mapping one module ID to another one.  当想对同一个资源指定多个版本时,应该使用map来加载多条路径 
-  ‘*‘:对于所有的模块加载,使用本map配置。如果还有更细化的map配置,会优先于"*"配置。
        例如: 
            ‘*‘: { ‘jquery‘: ‘jquery-private‘}, 
            ‘jquery-private‘: { ‘jquery‘: ‘jquery‘} 
        ‘jquery‘: ‘jquery-private‘: 表示所有的模块在依赖‘jquery‘,实际上依赖的是 ‘jquery-private‘ 
        ‘jquery-private’在表示依赖‘jquery‘时, 依赖的是真正的jQuery模块。如果不写这行,就会形成依赖循环。
原文:http://fannyhong.blog.51cto.com/12416556/1883708