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

emnapi WebAssembly build #1674

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

toyobayashi
Copy link

@toyobayashi toyobayashi commented Jan 20, 2023

I created emnapi for porting Node.js addons written in Node-API to Emscripten WebAssembly. I successfully built this project to wasm, all test cases passed except the one related to async_hooks, which is not supported by emnapi.

yarn node-pre-gyp configure --nodedir=./wasm --target_arch=wasm32
emmake yarn node-pre-gyp build --nodedir=./wasm --target_arch=wasm32
npx --arch=wasm32 yarn test

image

Update:

emnapi 0.28.1 has added the async_hooks support on Node.js. All test passed on my local machine.

image

@toyobayashi
Copy link
Author

Could you please enable CI for me?

@toyobayashi
Copy link
Author

const binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')), {
target_arch: process.env.npm_config_target_arch || process.env.npm_config_arch || process.arch
});
let binding = require(binding_path);

not sure why npx --arch=wasm32 yarn test doesn't work in CI, seems node-pre-gyp find wrong binding path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant