Features of RequireJS?

What Is config function in RequireJS?

What Is config function?
The RequireJS can be initialized by passing the main configuration in the HTML template through the data-main attribute.

If you want to update the RequireJS configuration values with your own configurations value. You can do using therequirejs.config function. 

The configurations options -
ü  config - This is for configuration to a module by using the config option
ü  baseUrl -This is the root path to start the loading of modules.
ü  paths - this is the path mapping for modules that don’t exists in under the base URL.
ü  Shims - This is use for configuration for dependencies.
ü  deps  - array of dependencies to load
ü  map  -
ü  urlArgs -This is the query string arguments are used to fetch all resources that are loaded by using RequireJS.
ü  callback -It executes a function after loading the dependencies and is required when Require is specified as config object before loading RequireJS.
ü  xhtml - It is used to create the script elements by using the document.createElementNS() method.
ü  scriptType - It defines the value for script type attribute used in the document. Default type is "text/javascript".

Example looks like-
require.config({
    baseUrl: 'scripts/app',
    paths: {
        lib: '../lib'
    },
    shim: {
        'backbone': {
            deps: ['underscore'],
            exports: 'Backbone'
        }
    }
});

I hope you are enjoying with this post! Please share with you friends!! Thank you!!!
ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..
My Blogs - https://code-sample.com and https://code-sample.xyz
My Book1 - BEST SELLING ANGULAR BOOK (INCLUDING ALL VERSIONS 2, 4, 5, 6, 7)
My Book2 - ANGULAR 2 INTERVIEW QUESTIONS BOOK - Both Books are Available on WorldWide.

www.code-sample.com/. Powered by Blogger.
^