Fix the undefined opts bug
This commit is contained in:
@@ -96,12 +96,12 @@ export class Compiler {
|
||||
* @return An instance of the Compiler class.
|
||||
*/
|
||||
constructor(opts?: CompilerOptions) {
|
||||
assert.doesConformToSchema('opts', opts, compilerOptionsSchema);
|
||||
const passedOpts = opts || {};
|
||||
assert.doesConformToSchema('opts', passedOpts, compilerOptionsSchema);
|
||||
// TODO: Look for config file in parent directories if not found in current directory
|
||||
const config: CompilerOptions = fs.existsSync(CONFIG_FILE)
|
||||
? JSON.parse(fs.readFileSync(CONFIG_FILE).toString())
|
||||
: {};
|
||||
const passedOpts = opts || {};
|
||||
assert.doesConformToSchema('compiler.json', config, compilerOptionsSchema);
|
||||
this._contractsDir = path.resolve(passedOpts.contractsDir || config.contractsDir || DEFAULT_CONTRACTS_DIR);
|
||||
this._solcVersionIfExists = passedOpts.solcVersion || config.solcVersion;
|
||||
|
Reference in New Issue
Block a user