Skip to content
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

Export Emscripten runtime for the Web #509

Merged
merged 1 commit into from
Jul 25, 2019

Commits on Jul 24, 2019

  1. Export Emscripten runtime for the Web

    Some runtime environments look like Node.js, but are not Node.js which
    confuses Emscripten loader code. I'm talking about JavaScript bundlers
    that are used for Web and Electron apps. These things make the code
    believe that it can use "require()" for importing and "module.exports"
    for exporting things, and expect this be the case.
    
    However, Emscripten believes that it is smarter, detects that it's not
    running in Node.js environment, and just uses "Module" for exports.
    This breaks bundler's expectation and various Emscripten runtime
    functions (like "allocate()") end up not being exported, resulting in
    weird TypeErrors when WasmThemis code tries calling them.
    
    This can be avoided by exporting whatever Emscripten wants to export
    in Node.js style via "module.exports". We can insert this code into
    generated file by using "--pre-js" flag of emcc.
    
    Since now we have more than one file for Emscripten compilation,
    move them all into a subdirectory to keep the root directory tidy.
    ilammy committed Jul 24, 2019
    Configuration menu
    Copy the full SHA
    157f747 View commit details
    Browse the repository at this point in the history