require Configuration
You can configure a require Object by associating a script to a JSON-formatted configuration file using the @NAmdConfig
JSDoc tag within your script.
Configuration of a require Object is optional and for advanced users only. If you must configure a require Object, the @NAmdConfig
JSDoc tag is suited for general use and is the preferred way to configure a require Object. However, existing scripts with calls to require.config()
can use this method with a context argument (although not preferred). Ensure that the call includes a context parameter and that its value is not a file path.
If you include a valid @NAmdConfig
JSDoc tag, SuiteScript implements the require configuration settings (in the specified file) before loading dependencies. Using different require configuration files allows you to run multiple client scripts with different configurations based on the @NAmdConfig
JSDoc tag included in each script. This also supports re-use by letting you use a common configuration across multiple scripts.
To configure a require Object, add the @NAmdConfig
JSDoc tag and provide the path to the configuration file. Configuration files must be located in the File Cabinet. For example:
/**
* @NAmdConfig /SuiteScripts/configuration.json
*/
SuiteScript will require a custom entry point module and its dependencies using the AMD configuration settings in the specified configuration file. Your require configuration must be in JSON format. For example:
{
"baseUrl" : "/SuiteBundles"
}
Ensure that your require configuration files use JSON syntax (and not JavaScript syntax). For more information about JSON, visit http://json.org/. You can use JSON.stringify(obj) to convert a JavaScript object value to a key-value pair string in JSON form.
For a list of supported configuration parameters, see require Configuration Parameters. Properties that can hold feature metadata, aliases, paths, package, and mapping information related to a module id are supported.
require Configuration Parameters
SuiteScript accepts the require configuration values described at https://github.com/amdjs/amdjs-api/blob/master/CommonConfig.md (version fd45c71).
You can use the @NAmdConfig
JSDoc tag to specify a configuration file that defines configuration values.
The following configuration parameters are supported in a require Object configuration file:
Parameter |
Type |
Required / Optional |
Sample Usage |
Since |
---|---|---|---|---|
|
string |
optional |
|
2015.2 |
|
Object |
optional |
|
2015.2 |
|
Object |
optional |
|
2015.2 |
|
Object[] |
optional |
|
2015.2 |
|
Object |
optional |
|
2015.2 |
|
Object |
optional |
|
2015.2 |
Refer to https://github.com/amdjs/amdjs-api/blob/master/CommonConfig.md for examples of each configuration parameter.
Configuration of a require Object is optional and for advanced users only. If you must configure a require Object, the @NAmdConfig
JSDoc tag is suited for general use and is the preferred way to configure a require Object. However, existing scripts with calls to require.config()
can use this method with a context argument (although not preferred). Ensure that the call includes a context parameter and that its value is not a file path.