-
Notifications
You must be signed in to change notification settings - Fork 520
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
feat(wasm): support output esm imports #1565
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1565 +/- ##
==========================================
- Coverage 76.49% 76.02% -0.47%
==========================================
Files 73 74 +1
Lines 7582 7672 +90
Branches 752 753 +1
==========================================
+ Hits 5800 5833 +33
- Misses 1781 1837 +56
- Partials 1 2 +1
|
The bundling works, tho the nitro dev doesn't. And it seems to be a rather complex thing to do right, maybe we better keep the experimental state? |
Working example with wasm bundled mode (Node dev/prod): export default defineLazyEventHandler(async () => {
const { sum } = await import("./sum.wasm")
.then((wasm) => wasm.default({}))
.then((r) => r.instance.exports);
return eventHandler((event) => {
return sum(1, 2);
});
}); Working example with new export default defineLazyEventHandler(async () => {
const { sum } = await import("./sum.wasm")
.then((mod) => WebAssembly.instantiate(mod.default, {}))
.then((instance) => instance.exports);
return eventHandler((event) => {
return sum(1, 2);
});
}); I wish we could find a way to keep API consistant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM. Let's keep it under the experimental flag until we can unify usage across.
π Linked issue
β Type of change
π Description
π Checklist