Inline wasm file for easier cross-platform setup#65
Merged
herumi merged 1 commit intoherumi:masterfrom Oct 30, 2020
Merged
Conversation
With `MODULARIZE=1` set, we instead emit the code wrapped in a function that returns a promise. The promise is resolved with the module instance when it is safe to run the compiled code, similar to the `onRuntimeInitialized` callback. You do not need to use the `onRuntimeInitialized` callback when using `MODULARIZE`. ``` EMCC_OPT+=-s MODULARIZE=1 ``` The default name of the function is `Module`, but can be changed using the `EXPORT_NAME` The factory function accepts 1 parameter, an object with default values the instance ``` EMCC_OPT+=-s EXPORT_NAME='createBlsModule' ``` Export using an ES6 Module export rather than a UMD export Disable import feature 'import.meta.url', not supported on old browsers / toolchains ``` EMCC_OPT+=-s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0 ``` STRICT_JS = 1, adds "use strict;" to generated JS ``` EMCC_OPT+=-s STRICT_JS=1 ``` SINGLE_FILE=1, embeds all subresources in the emitted file as base64 string literals. Embedded subresources may include (but aren't limited to) wasm, asm.js, and static memory initialization code. ``` EMCC_OPT+=-s SINGLE_FILE=1 ``` Pass -s MINIFY_HTML=0 to explicitly choose to disable HTML minification altogether ``` EMCC_OPT+=-s MINIFY_HTML=0 ``` Do not minify target javascript file (only a +0.8% size increase) ``` EMCC_OPT+=--minify 0 ```
This was referenced Oct 28, 2020
Owner
|
Thank you for the useful patch. I've merged it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Should be merged with herumi/bls-eth-wasm#5
With
MODULARIZE=1set, we instead emitthe code wrapped in a function that returns a promise. The promise is
resolved with the module instance when it is safe to run the compiled code,
similar to the
onRuntimeInitializedcallback. You do not need to use theonRuntimeInitializedcallback when usingMODULARIZE.The default name of the function is
Module, but can be changed using theEXPORT_NAMEThe factory function accepts 1 parameter, an object with default values the instance
STRICT_JS = 1, adds "use strict;" to generated JS
SINGLE_FILE=1, embeds all subresources in the emitted file as base64 string
literals. Embedded subresources may include (but aren't limited to) wasm,
asm.js, and static memory initialization code.
Pass -s MINIFY_HTML=0 to explicitly choose to disable HTML minification altogether
Do not minify target javascript file (only a +0.8% size increase)