New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MODULARIZE & EXPORT_NAME build options oddities #7950
Comments
Hmm, further, docs in settings.js say
However if I do a var EmscriptenCode = function(Module) {
Module = Module || {};
// .. all the emitted code from emscripten ..
return Module;
}; in my build. But instead I get var EmscriptenCode = (function() {
return (function(EmscriptenCode) {
EmscriptenCode = EmscriptenCode || {};
...
return EmscriptenCode;
});
})(); which seems unnecessary - the inner |
About the name being replaced in more places - yeah, that might be redundant, maybe we did it for aesthetic purposes. I'm not sure - may need to look through the PRs. |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant. |
See this is closed, but still a little confused, not being a JS expert. If I build with
but I dont think it gets used at
Would I be right in saying that
Which I could put in |
@yowl note that In general I think the default html shell files just set values to |
Consider
This produces a web page that does not run, but gives no build errors either.
There are two things that are odd about the generated build.
First, I think the history of -s MODULARIZE=1 was intended to be primarily used when building to JavaScript with
-o a.js
, so the intent is that one would manually invoke the generateModule()
function (defined with-s EXPORT_NAME=
option) to start the app. But when one is targeting HTML with any of the default html shell files that Emscripten provides (no--shell-file
directive passed, or--shell-file src/shell_minimal.html
) it seems that we should be automatically be generating aModule();
invocation there to start the page.Second, why is the default value of the
-s EXPORT_NAME=
option calledModule
? That seems wrong.Module
is supposed to be an object that contains import/export interactions with the generated page. InMODULARIZE
modeEXPORT_NAME
specifies the name of the function that one should call to launch the page. Calling this function alsoModule
seems like we are calling two different things by the same name, and by default, one would need to callModule(Module);
to run the page. Hence when buildingit is not possible to launch the generated build even from web console.
Perhaps default value of
EXPORT_NAME
should be changed to something like'EmscriptenCode'
, so that the default launch sequence would look likeEmscriptenCode(Module);
, and our default shells would add a{{{ EXPORT_NAME }}}(Module);
directive to them?The text was updated successfully, but these errors were encountered: