Fix for node 8.x solc tests.

This commit is contained in:
Richard Moore 2020-02-12 15:00:18 -05:00
parent fa25e61f77
commit 133291e9ba
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

@ -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 {