Add workaround for hello_world running in Chrome

Fixes #50.
This commit is contained in:
Sophie Alpert
2018-03-03 10:46:43 -08:00
parent 98b9bee876
commit 67411f519c
5 changed files with 28 additions and 2 deletions

View File

@ -3,6 +3,15 @@
// will work here one day as well!
const js = import("./hello_world");
js.then(js => {
Promise.all([
js,
// Due to https://github.com/webpack/webpack/issues/6475, Webpack does not
// support sync wasm imports larger than 4kB in Chrome. We use wasm2es6js to
// hack around this and need to defer our call until the converted wasm
// module is asynchronously loaded. Uncomment this line to enable.
// This hack is not necessary in Firefox.
// import("./hello_world_wasm.js").then(wasm => wasm.booted),
]).then(([js]) => {
js.greet("World!");
});