Skip to content

Commit 811564e

Browse files
authored
Fix loading import (remix-tests)
1 parent 72b7728 commit 811564e

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

libs/remix-tests/src/compiler.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ function processFile (filePath: string, sources: SrcIfc, isRoot = false) {
6262
content = includeTestLibs.concat(content)
6363
}
6464
sources[filePath] = { content }
65-
importRegEx.exec('') // Resetting state of RegEx
66-
67-
// Process each 'import' in file content
68-
while ((group = importRegEx.exec(content))) {
69-
const importedFile: string = group[1]
70-
const importedFilePath: string = path.join(path.dirname(filePath), importedFile)
71-
processFile(importedFilePath, sources)
72-
}
7365
}
7466

7567
const userAgent = (typeof (navigator) !== 'undefined') && navigator.userAgent ? navigator.userAgent.toLowerCase() : '-'
@@ -123,7 +115,13 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts
123115
} finally {
124116
async.waterfall([
125117
function loadCompiler (next) {
126-
compiler = new RemixCompiler()
118+
compiler = new RemixCompiler((url, cb) => {
119+
try {
120+
cb(null, fs.readFileSync(url, 'utf-8'))
121+
} catch (e) {
122+
cb(e.message)
123+
}
124+
})
127125
if (compilerConfig) {
128126
const { currentCompilerUrl, evmVersion, optimize, runs } = compilerConfig
129127
if (evmVersion) compiler.set('evmVersion', evmVersion)

0 commit comments

Comments
 (0)