consider remappings for use config file option too

pull/4229/head
aniket-engg 1 year ago
parent 5e8614e048
commit 38feabf5f2
  1. 6
      libs/remix-solidity/src/compiler/compiler.ts
  2. 2
      libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts

@ -215,7 +215,6 @@ export class Compiler {
try { try {
if (source && source.sources) { if (source && source.sources) {
const { optimize, runs, evmVersion, language, remappings, useFileConfiguration, configFileContent } = this.state const { optimize, runs, evmVersion, language, remappings, useFileConfiguration, configFileContent } = this.state
console.log('remappings---->', remappings)
if (useFileConfiguration) { if (useFileConfiguration) {
input = compilerInputForConfigFile(source.sources, JSON.parse(configFileContent)) input = compilerInputForConfigFile(source.sources, JSON.parse(configFileContent))
} else { } else {
@ -338,7 +337,10 @@ export class Compiler {
try { try {
if (useFileConfiguration) { 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 { } else {
input = compilerInput(source.sources, { optimize, runs, evmVersion, language, remappings }) input = compilerInput(source.sources, { optimize, runs, evmVersion, language, remappings })
} }

@ -110,7 +110,7 @@ export class CompileTabLogic {
const sources = { [target]: { content } } const sources = { [target]: { content } }
this.event.emit('removeAnnotations') this.event.emit('removeAnnotations')
this.event.emit('startingCompilation') 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.api.readFile('remappings.txt').then( remappings => {
this.compiler.set('remappings', remappings.split('\n')) this.compiler.set('remappings', remappings.split('\n'))
}) })

Loading…
Cancel
Save