title: WASM react module parse failed: magic header not detected
body: <p>I'm trying to load a simple web assembly module in a react project. The wasm module was compiled with the <code>MODULARIZE</code> option.</p>
  
  <p>From the <a href="https://developer.mozilla.org/en-US/docs/WebAssembly/Loading_and_running" rel="nofollow noreferrer">documentation</a> I've tried incorporating this into my code as follows:</p>
  
  <pre><code>fetch('./my-library.wasm')
    .then(response =&gt; response.arrayBuffer())
    .then(bytes =&gt; WebAssembly.instantiate(bytes))
    .then(results =&gt; {
      console.log("do something");
    });
  </code></pre>
  
  <p>Where ideally I would like to store the results in the <code>state</code> so I can access the module throughout the code (replacing the console log).</p>
  
  <p>Unfortunately this gives me the error</p>
  
  <pre><code>Unhandled Rejection (CompileError): wasm validation error: at offset 4: failed to match magic number
  </code></pre>
  
  <p>What am I missing? Compiling without <code>MODULARIZE</code> also gives this error.</p>