refactor: move xmodule folder to root
- Moving xmodule folder to root as we're dissolving sub-projects of common folder in edx-platform
- More info: https://openedx.atlassian.net/browse/BOM-2579
- -e common/lib/xmodule has been removed from the requirements as xmodule has itself become the part of edx-platform and not being installed through requirements
- The test files common/lib/xmodule/test_files/ have been removed as they are not being used anymore
This commit is contained in:
49
xmodule/js/spec/main_requirejs.js
Normal file
49
xmodule/js/spec/main_requirejs.js
Normal file
@@ -0,0 +1,49 @@
|
||||
(function(requirejs, define) {
|
||||
'use strict';
|
||||
// We do not wish to bundle common libraries (that may also be used by non-RequireJS code on the page
|
||||
// into the optimized files. Therefore load these libraries through script tags and explicitly define them.
|
||||
// Note that when the optimizer executes this code, window will not be defined.
|
||||
if (window) {
|
||||
var defineDependency = function(globalName, name, noShim) {
|
||||
var getGlobalValue = function(name) {
|
||||
var globalNamePath = name.split('.'),
|
||||
result = window,
|
||||
i;
|
||||
for (i = 0; i < globalNamePath.length; i++) {
|
||||
result = result[globalNamePath[i]];
|
||||
}
|
||||
return result;
|
||||
},
|
||||
globalValue = getGlobalValue(globalName);
|
||||
if (globalValue) {
|
||||
if (noShim) {
|
||||
define(name, {});
|
||||
} else {
|
||||
define(name, [], function() { return globalValue; });
|
||||
}
|
||||
} else {
|
||||
console.error('Expected library to be included on page, but not found on window object: ' + name);
|
||||
}
|
||||
};
|
||||
defineDependency('jQuery', 'jquery');
|
||||
defineDependency('jQuery', 'jquery-migrate');
|
||||
defineDependency('_', 'underscore');
|
||||
}
|
||||
requirejs.config({
|
||||
baseUrl: '/base/',
|
||||
paths: {
|
||||
moment: 'common_static/common/js/vendor/moment-with-locales',
|
||||
draggabilly: 'common_static/js/vendor/draggabilly',
|
||||
'edx-ui-toolkit': 'common_static/edx-ui-toolkit',
|
||||
hls: 'common_static/common/js/vendor/hls'
|
||||
},
|
||||
shim: {
|
||||
moment: {
|
||||
exports: 'moment'
|
||||
},
|
||||
hls: {
|
||||
exports: 'Hls'
|
||||
}
|
||||
}
|
||||
});
|
||||
}).call(this, RequireJS.requirejs, RequireJS.define);
|
||||
Reference in New Issue
Block a user