From 8a71154284970dbf118e13f16f44d162419a63e8 Mon Sep 17 00:00:00 2001 From: subtly Date: Tue, 30 Apr 2019 02:34:37 +0800 Subject: [PATCH] fix for electron w/dynamic loading of solcjson This is a fix so that remix will work inside of electron, and presumably, it makes sense for dynamic downloading of solidity compiler. When I enable node integration with electron and install solc node module, it looks like it works for a second, but then it too does not work (page goes blank). I'm not sure if require() works here with node, as I believe solcjson would need to be downloaded into a path that can be resolved by require (typically node_modules). Notably, electron docs recommend against enabling node integration when remote scripts are loaded dynamically. --- remix-solidity/src/compiler/compiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remix-solidity/src/compiler/compiler.js b/remix-solidity/src/compiler/compiler.js index 0109223932..3766d8beea 100644 --- a/remix-solidity/src/compiler/compiler.js +++ b/remix-solidity/src/compiler/compiler.js @@ -74,7 +74,7 @@ function Compiler (handleImportCall) { if (worker === null) { var compiler var userAgent = (typeof (navigator) !== 'undefined') && navigator.userAgent ? navigator.userAgent.toLowerCase() : '-' - if (typeof (window) === 'undefined' || userAgent.indexOf(' electron/') > -1) { + if (typeof (window) === 'undefined') { compiler = require('solc') } else { compiler = solc(window.Module)