diff --git a/emcc.py b/emcc.py index 6e6e3656f54f9..26d0413507bcb 100755 --- a/emcc.py +++ b/emcc.py @@ -2850,17 +2850,16 @@ def modularize(): # Export using a UMD style export, or ES6 exports if selected if shared.Settings.EXPORT_ES6: - f.write('''export default %s;''' % shared.Settings.EXPORT_NAME) + f.write('export default %s;' % shared.Settings.EXPORT_NAME) elif not shared.Settings.MINIMAL_RUNTIME: - f.write('''if (typeof exports === 'object' && typeof module === 'object') - module.exports = %(EXPORT_NAME)s; - else if (typeof define === 'function' && define['amd']) - define([], function() { return %(EXPORT_NAME)s; }); - else if (typeof exports === 'object') - exports["%(EXPORT_NAME)s"] = %(EXPORT_NAME)s; - ''' % { - 'EXPORT_NAME': shared.Settings.EXPORT_NAME - }) + f.write('''\ +if (typeof exports === 'object' && typeof module === 'object') + module.exports = %(EXPORT_NAME)s; +else if (typeof define === 'function' && define['amd']) + define([], function() { return %(EXPORT_NAME)s; }); +else if (typeof exports === 'object') + exports["%(EXPORT_NAME)s"] = %(EXPORT_NAME)s; +''' % {'EXPORT_NAME': shared.Settings.EXPORT_NAME}) save_intermediate('modularized') diff --git a/src/postamble.js b/src/postamble.js index d83d2ead0df44..ef16140572295 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -373,17 +373,13 @@ function exit(status, implicit) { if (!implicit) { #if EXIT_RUNTIME == 0 var msg = 'program exited (with status: ' + status + '), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)'; -#if MODULARIZE - readyPromiseReject(msg); -#endif // MODULARIZE - err(msg); #else var msg = 'program exited (with status: ' + status + '), but noExitRuntime is set due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)'; +#endif // EXIT_RUNTIME #if MODULARIZE readyPromiseReject(msg); #endif // MODULARIZE err(msg); -#endif // EXIT_RUNTIME } #endif // ASSERTIONS } else {