Skip to content

Commit 68919f2

Browse files
committed
fix: in EXPORT_ALL and maybe other cases we export earlier than in maybeExport; just check if it exists already before exporting, don't override something
1 parent 66f5f73 commit 68919f2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/modules.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,10 @@ function maybeExport(name) {
280280
// stub with an error, so the user gets a message
281281
// if it is used, that they should export it
282282
if (ASSERTIONS) {
283-
return 'Module["' + name + '"] = function() { abort("\'' + name + '\' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS.") };';
283+
// check if it already exists, to support EXPORT_ALL and other cases
284+
// (we could optimize this, but in ASSERTIONS mode code size doesn't
285+
// matter anyhow)
286+
return 'if (!Module["' + name + '"]) Module["' + name + '"] = function() { abort("\'' + name + '\' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS.") };';
284287
}
285288
return '';
286289
}

0 commit comments

Comments
 (0)