X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/d3865d294299f1d5404b59f4482ebb116c8fcee0..90dd6ff11965499c5a211e2b78755baa3ab2e09c:/Execute.cpp diff --git a/Execute.cpp b/Execute.cpp index 3d9d6c4..c6812a2 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -2092,7 +2092,13 @@ static JSValueRef require(JSContextRef context, JSObjectRef object, JSObjectRef CYCallAsFunction(context, function, NULL, 3, arguments); } - return CYGetProperty(context, module, property); + JSObjectRef exports(CYCastJSObject(context, CYGetProperty(context, module, property))); + + CYJSString _default("default"); + if (JSValueIsUndefined(context, CYGetProperty(context, exports, _default))) + CYSetProperty(context, exports, _default, exports, kJSPropertyAttributeDontEnum); + + return exports; } CYCatch(NULL) } static bool CYRunScript(JSGlobalContextRef context, const char *path) {