Configuration of the Requirejs

Source: Internet
Author: User

BASEURL: Find root path for all modules.

  1. The BaseURL is not used when loading a pure. js file (the dependent string starts with/begins with, or ends with. js, or contains a protocol ).
  2. If BaseURL is not explicitly set, the default value is where the HTML that loads the Require.js is located. If you use theData-mainproperty, the path becomes baseurl.
  3. The BaseURL can be in a different domain than the Require.js page, and the Requirejs script is loaded across domains.

Paths :path maps the name of a module that is not placed directly under BaseURL. The start position when you set path is relative to BaseURL, unless the path setting starts with "/" or contains a URL protocol (such as http:).

the path used for the module name should not contain the. js suffix, because a path may be mapped to a directory. The path resolution mechanism automatically adds the. js suffix when mapping the module name to path. When you use Require.tourl () in a scene such as a text template, It also adds the appropriate suffix.

Shim: For those that do not use define () to declare dependencies, set the module's "Browser global variable Injection" script to do the dependency and export configuration.

map : For a given module prefix, use a different module ID to load the module.

Config : It is often necessary to pass configuration information to a module. These configurations are often application levels of information and require a means to pass them down to the module. In Requirejs, the config configuration item based on the Requirejs.config () is implemented. To get this information the module can load a special dependent "module" and call Module.config ().

Configuration of the Requirejs

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.