-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Including an emscripten module in browserify build process #5864
Comments
module.exports is set only when ENVIRONMENT_IS_NODE is true, and it won't be true if ENVIRONMENT_IS_WEB is true:
I think it would be best to always set module.exports (if module exists etc), like it does for MODULARIZE. Turning MODULARIZE on will probably help you @txusinho, but you will need to access the exported functions differently. |
@curiousdannii I appreciate your help, and the speed! The solution worked perfect on my side, and I'm able to use module as needed. The access to functions is not a problem if I have possibilities to access the Module element. I made this question also in stackoverflow, I'll update the answer there so anyone with the same problem can come to a solution.
EDIT 2: I replaced the flag instead of adding it. Forget what I said |
…#5864) Also provide .then() when in MODULARIZE_INSTANCE mode (emscripten-core#6442)
#Hi all,
First of all, I would like to apologize if this is not the right place to ask for help to solve this issue. I'm a browserify user, and since I have problems just with a file create by emscripten, I assume the problem might live here.
Long story short, I'm importing an emscripten module in the frontend using browserify. At execution time, the module exists, but empty.
You can reproduce the issue as follows (requires emcc and browserify installed system wide):
emcc main.cpp -o main.js -s EXPORTED_FUNCTIONS="['_int_sqrt']"
browserify index.js > bundle.js
I've already tested that the generated code is correct: running in a node environment, works as expected (there is a demonstration using mocha here
PD: I have the same test case, but with a more elaborated toolchain in this repo with a readme to reproduce all the steps
The text was updated successfully, but these errors were encountered: