Closed
Description
I think we should remove that option for several reasons:
--post-js
made a lot of sense for JS and asm.js as startup was synchronous there. So adding some code after the main JS would result in it being run as you expect. Even this became a little complicated with async startup due to things like file preloading, but overall worked well. But with wasm, we assume async startup in the common case. And, if async startup is the norm, then all you need is--pre-js
- you add the code you want to run later in a callback, likeModule.onRuntimeInitialized
. Having--post-js
is just an opportunity for confusion.- Another possible confusion is that the combination of
--pre-js
and--post-js
has been seen as a way to wrap the entire output in a function scope. This was never intended: we have MODULARIZE for that, and also, wrapping the output in a new scope the optimizer doesn't see confuses it. - Removing
--post-js
will make some future refactorings of our JS easier, in particular Feedback wanted: Allow custom "core JS" replacements, to *really* shrink minimal JS sizes #6803.
This change may require a bunch of work on tests, so I'm opening this issue for discussion first, as opposed to having the discussion on a PR with code.
Metadata
Metadata
Assignees
Labels
No labels