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.
Put all third-party dependencies, such as jquery, in the Lib folder. BaseURL is set to Lib,requirejs based on this directory to find dependent modules. If not set, BaseURL defaults to the path where the specified file (specified in HTML) is Data-main.
Paths:the paths config is only for setting up root paths for module IDs. Paths configuration is used only to set the root path of the corresponding module ID
-app: '.. /app '
The declaration relies on require (["App/common"]: when, in fact, is looking for. /app/common.js.
-Text: ' Require-text/text '
For plug-ins, such as text, there are the following statements: such as written in map:*, cannot be loaded under node successfully.
-there is a saying, not the path that begins with the item declared in paths, not affected. But in actual use, will still be substituted.
For example, require ([".. /.. /app/common "], where the app will be substituted for: /app
Map:mapping One module ID to another one. When you want to specify multiple versions of the same resource, you should use map to load multiple paths
-' * ': for all module loads, use this map configuration. If there is a more granular map configuration, it will take precedence over the "*" configuration.
For example:
' * ': {' jquery ': ' Jquery-private '},
' Jquery-private ': {' jquery ': ' jquery '}
' jquery ': ' jquery-private ': means that all modules rely on ' jquery ' and actually rely on ' jquery-private '
' Jquery-private ' relies on the real jquery module when it comes to "jquery." If you do not write this line, you will form a dependency loop.
Requirejs Study Notes