title: How load an emscripten generated module with es6 import?
body: <p>I am trying to import a module generated with emscripten as a es6 module.
  I am trying with the <a href="https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#interacting-with-code" rel="noreferrer">basic example</a> from emscripten doc.</p>
  
  <p>This is the command I am using to generate the js module from the C module:</p>
  
  <p><code>emcc example.cpp -o example.js -s EXPORTED_FUNCTIONS="['_int_sqrt']" -s EXTRA_EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap']" -s EXPORT_ES6=1 -s MODULARIZE=1</code></p>
  
  <p>The C module :</p>
  
  <pre><code>#include &lt;math.h&gt;
  
  extern "C" {
  
    int int_sqrt(int x) {
      return sqrt(x);
    }
  }
  </code></pre>
  
  <p>Then importing the generated js module:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en" dir="ltr"&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;Wasm example&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;script type="module"&gt;
        import Module from './example.js'
  
        int_sqrt = Module.cwrap('int_sqrt', 'number', ['number']);
        console.log(int_sqrt(64));
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is failing because cwrap is not available on the Module object:</p>
  
  <p><code>Uncaught TypeError: Module.cwrap is not a function</code> </p>