1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 05:19:57 +00:00

Prioritize "module.exports" over "exports" in require sandbox

(Node-ism, inherited (temporarily?) to support codemirror upgrade)
This commit is contained in:
natecain 2014-05-06 23:31:57 +02:00
parent 51f54b06f9
commit 6b03789e06

View File

@ -677,6 +677,9 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
} else if(typeof moduleInfo.definition === "string") { // String } else if(typeof moduleInfo.definition === "string") { // String
moduleInfo.exports = _exports; moduleInfo.exports = _exports;
$tw.utils.evalSandboxed(moduleInfo.definition,sandbox,tiddler.fields.title); $tw.utils.evalSandboxed(moduleInfo.definition,sandbox,tiddler.fields.title);
if(sandbox.module.exports) {
moduleInfo.exports = sandbox.module.exports; //more codemirror workaround
}
} else { // Object } else { // Object
moduleInfo.exports = moduleInfo.definition; moduleInfo.exports = moduleInfo.definition;
} }