-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
WABT can be useful in the browser, but there's no way to import it there.
Adding the following line to the very end of the wabt.js
file (available from the CDNs) makes it importable (as a standard ES6 module):
export default WabtModule;
The API can then be imported using any name you like (Wabt
in this example):
import Wabt from "path/to/wabt.js";
const wabt = await Wabt();
const module = wabt.readWasm(someBinary, {});
Note: If your browser lacks support for top-level await, you'd need to wrap that code in an async-function.
IIUC, Node has provided "experimental support" for ES6 modules for some years, so the parser shouldn't choke on the export statement.
Unless I'm missing something, it seems like it'd be a simple change (and this has been requested a few times, in one form or another). Thanks for considering it, either way.
Metadata
Metadata
Assignees
Labels
No labels