Improve leniency of --no-modules output

Instead of assuming names like `URL` and `Request` are defined, instead
check to see if they exist first and otherwise skip the checks that
reference them.
This commit is contained in:
Alex Crichton 2019-07-29 14:49:15 -07:00
parent 68a1519eaa
commit 423bebbd14

View File

@ -502,7 +502,7 @@ impl<'a> Context<'a> {
let result;
const imports = {{}};
{imports_init}
if (module instanceof URL || typeof module === 'string' || module instanceof Request) {{
if ((typeof URL === 'function' && module instanceof URL) || typeof module === 'string' || (typeof Request === 'function' && module instanceof Request)) {{
{init_memory2}
const response = fetch(module);
if (typeof WebAssembly.instantiateStreaming === 'function') {{