From 133291e9ba72f00fe730d115cd9abe176ef5124e Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Wed, 12 Feb 2020 15:00:18 -0500 Subject: [PATCH] Fix for node 8.x solc tests. --- packages/cli/src.ts/solc.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/cli/src.ts/solc.ts b/packages/cli/src.ts/solc.ts index e1a373cd8..5ed97697b 100644 --- a/packages/cli/src.ts/solc.ts +++ b/packages/cli/src.ts/solc.ts @@ -125,8 +125,13 @@ function _compile(_solc: any, source: string, options?: CompilerOptions): Array< // Creates a require which will first search from the current location, // and for solc will fallback onto the version included in @ethersproject/cli export function customRequire(path: string): (name: string) => any { - const pathRequire = _module.createRequireFromPath(resolve(path, "./sandbox.js")); - const libRequire = _module.createRequireFromPath(resolve(__filename)); + // Node 8.x does not support createRequireFromPath + const createRequire = (_module.createRequireFromPath || (function(path: string) { + return require + })); + + const pathRequire = createRequire(resolve(path, "./sandbox.js")); + const libRequire = createRequire(resolve(__filename)); return function(name: string): any { try {