@@ -47,7 +47,6 @@ function isRemixTestFile (path: string) {
4747
4848function processFile ( filePath : string , sources : SrcIfc , isRoot = false ) {
4949 const importRegEx = / i m p o r t [ ' " ] ( .+ ?) [ ' " ] ; / g
50- let group : RegExpExecArray | null = null
5150 const isFileAlreadyInSources : boolean = Object . keys ( sources ) . includes ( filePath )
5251
5352 // Return if file is a remix test file or already processed
@@ -62,14 +61,6 @@ function processFile (filePath: string, sources: SrcIfc, isRoot = false) {
6261 content = includeTestLibs . concat ( content )
6362 }
6463 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- }
7364}
7465
7566const userAgent = ( typeof ( navigator ) !== 'undefined' ) && navigator . userAgent ? navigator . userAgent . toLowerCase ( ) : '-'
@@ -123,7 +114,13 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts
123114 } finally {
124115 async . waterfall ( [
125116 function loadCompiler ( next ) {
126- compiler = new RemixCompiler ( )
117+ compiler = new RemixCompiler ( ( url , cb ) => {
118+ try {
119+ cb ( null , fs . readFileSync ( url , 'utf-8' ) )
120+ } catch ( e ) {
121+ cb ( e . message )
122+ }
123+ } )
127124 if ( compilerConfig ) {
128125 const { currentCompilerUrl, evmVersion, optimize, runs } = compilerConfig
129126 if ( evmVersion ) compiler . set ( 'evmVersion' , evmVersion )
0 commit comments