Something like that?
define([], function () {
function realWork (modulea) {
if (modulea) {
...
}
}
if (isAdmin) {
require(["modulea"], function (modulea) {
realWork(modulea);
});
} else {
realWork();
}
});
You may be able to write your own requirejs plugin to remove this if you find yourself repeating the pattern.
source
share