diff --git a/src/static/js/ace.js b/src/static/js/ace.js index 87068d07d..26d6c0eb6 100644 --- a/src/static/js/ace.js +++ b/src/static/js/ace.js @@ -268,12 +268,6 @@ require.setGlobalKeyPath("require");\n\ parent_req = require("ep_etherpad-lite/static/js/pluginfw/parent_require");\ parent_req.getRequirementFromParent(require, "ep_etherpad-lite/static/js/pluginfw/hooks");\ parent_req.getRequirementFromParent(require, "ep_etherpad-lite/static/js/pluginfw/plugins");\ - parent_req.getRequirementFromParent(require, "./pluginfw/hooks");\ - parent_req.getRequirementFromParent(require, "./pluginfw/plugins");\ - require.define("/plugins", null);\n\ - require.define("/plugins.js", function (require, exports, module) {\ - module.exports = require("ep_etherpad-lite/static/js/plugins");\ - });\ \ '); diff --git a/src/static/js/pluginfw/parent_require.js b/src/static/js/pluginfw/parent_require.js index d7f6190d4..cd3b9218f 100644 --- a/src/static/js/pluginfw/parent_require.js +++ b/src/static/js/pluginfw/parent_require.js @@ -19,19 +19,21 @@ * @params reqModuleName Module name e.g. (ep_etherpad-lite/static/js/plugins) */ exports.getRequirementFromParent = function(requireDefObj, reqModuleName) { - requireDefObj.define(reqModuleName, function(require, exports, module) { - var t = parent; - var max = 0; // make sure I don't go up more than 10 times - while (typeof(t) != "undefined") { - max++; - if (max==10) - break; - if (typeof(t.require) != "undefined") { - module.exports = t.require(reqModuleName); - return; - } - t = t.parent; - } - }); - + // Force the 'undefinition' of the modules (if they already have been loaded). + delete (requireDefObj._definitions)[reqModuleName]; + delete (requireDefObj._modules)[reqModuleName]; + requireDefObj.define(reqModuleName, function(require, exports, module) { + var t = parent; + var max = 0; // make sure I don't go up more than 10 times + while (typeof(t) != "undefined") { + max++; + if (max==10) + break; + if (typeof(t.require) != "undefined") { + module.exports = t.require(reqModuleName); + return; + } + t = t.parent; + } + }); }