From 38feabf5f2792fd0f21678b9eea369e38e70380b Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 10 Nov 2023 22:02:03 +0530 Subject: [PATCH] consider remappings for use config file option too --- libs/remix-solidity/src/compiler/compiler.ts | 6 ++++-- .../solidity-compiler/src/lib/logic/compileTabLogic.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/remix-solidity/src/compiler/compiler.ts b/libs/remix-solidity/src/compiler/compiler.ts index b2567ea4d5..7c1c5fa1e3 100644 --- a/libs/remix-solidity/src/compiler/compiler.ts +++ b/libs/remix-solidity/src/compiler/compiler.ts @@ -215,7 +215,6 @@ export class Compiler { try { if (source && source.sources) { const { optimize, runs, evmVersion, language, remappings, useFileConfiguration, configFileContent } = this.state - console.log('remappings---->', remappings) if (useFileConfiguration) { input = compilerInputForConfigFile(source.sources, JSON.parse(configFileContent)) } else { @@ -338,7 +337,10 @@ export class Compiler { try { if (useFileConfiguration) { - input = compilerInputForConfigFile(source.sources, JSON.parse(configFileContent)) + let compilerInput = JSON.parse(configFileContent) + if (compilerInput.settings.remappings?.length) compilerInput.settings.remappings.push(...remappings) + else compilerInput.settings.remappings = remappings + input = compilerInputForConfigFile(source.sources, compilerInput) } else { input = compilerInput(source.sources, { optimize, runs, evmVersion, language, remappings }) } diff --git a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts index e6e7beb0a5..941296597e 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts +++ b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts @@ -110,7 +110,7 @@ export class CompileTabLogic { const sources = { [target]: { content } } this.event.emit('removeAnnotations') this.event.emit('startingCompilation') - if(!this.useFileConfiguration && await this.api.fileExists('remappings.txt')) { + if(await this.api.fileExists('remappings.txt')) { this.api.readFile('remappings.txt').then( remappings => { this.compiler.set('remappings', remappings.split('\n')) })