in src/loader.js [270:344]
ConfigurationOptionsUtil.validateConfigurationOptions = function (options) {
function defaultOnError(err) {
if (err.phase === 'loading') {
console.error('Loading "' + err.moduleId + '" failed');
console.error(err);
console.error('Here are the modules that depend on it:');
console.error(err.neededBy);
return;
}
if (err.phase === 'factory') {
console.error('The factory function of "' + err.moduleId + '" has thrown an exception');
console.error(err);
console.error('Here are the modules that depend on it:');
console.error(err.neededBy);
return;
}
}
options = options || {};
if (typeof options.baseUrl !== 'string') {
options.baseUrl = '';
}
if (typeof options.isBuild !== 'boolean') {
options.isBuild = false;
}
if (typeof options.paths !== 'object') {
options.paths = {};
}
if (typeof options.config !== 'object') {
options.config = {};
}
if (typeof options.catchError === 'undefined') {
options.catchError = false;
}
if (typeof options.recordStats === 'undefined') {
options.recordStats = false;
}
if (typeof options.urlArgs !== 'string') {
options.urlArgs = '';
}
if (typeof options.onError !== 'function') {
options.onError = defaultOnError;
}
if (!Array.isArray(options.ignoreDuplicateModules)) {
options.ignoreDuplicateModules = [];
}
if (options.baseUrl.length > 0) {
if (!AMDLoader.Utilities.endsWith(options.baseUrl, '/')) {
options.baseUrl += '/';
}
}
if (typeof options.cspNonce !== 'string') {
options.cspNonce = '';
}
if (typeof options.preferScriptTags === 'undefined') {
options.preferScriptTags = false;
}
if (!Array.isArray(options.nodeModules)) {
options.nodeModules = [];
}
if (options.nodeCachedData && typeof options.nodeCachedData === 'object') {
if (typeof options.nodeCachedData.seed !== 'string') {
options.nodeCachedData.seed = 'seed';
}
if (typeof options.nodeCachedData.writeDelay !== 'number' || options.nodeCachedData.writeDelay < 0) {
options.nodeCachedData.writeDelay = 1000 * 7;
}
if (!options.nodeCachedData.path || typeof options.nodeCachedData.path !== 'string') {
var err = ensureError(new Error('INVALID cached data configuration, \'path\' MUST be set'));
err.phase = 'configuration';
options.onError(err);
options.nodeCachedData = undefined;
}
}
return options;
};