From 3ec91a8d8a1c83d358a599b83740416cad783a87 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 23 May 2019 16:12:32 -0700 Subject: [PATCH] Wasm: When in node, use fs APIs to load language wasm files Fixes #338 --- lib/binding_web/binding.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/binding_web/binding.js b/lib/binding_web/binding.js index bbe3fe81..6ed93f57 100644 --- a/lib/binding_web/binding.js +++ b/lib/binding_web/binding.js @@ -567,8 +567,9 @@ class Language { static load(url) { let bytes; if ( - typeof require === 'function' && - require('url').parse(url).protocol == null + typeof process !== 'undefined' && + process.versions && + process.versions.node ) { const fs = require('fs'); bytes = Promise.resolve(fs.readFileSync(url));