Skip to content

Commit

Permalink
inline interopDefault in config loading (#2782)
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford authored and lukastaegert committed Apr 2, 2019
1 parent 8825cdb commit dba1438
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions bin/src/run/loadConfigFile.ts
Expand Up @@ -10,10 +10,6 @@ interface NodeModuleWithCompile extends NodeModule {
_compile(code: string, filename: string): any;
}

function interopDefault<T>(ex: T): T {
return ex && typeof ex === 'object' && 'default' in ex ? (ex as any).default : ex;
}

export default function loadConfigFile(
configFile: string,
commandOptions: any = {}
Expand Down Expand Up @@ -54,8 +50,9 @@ export default function loadConfigFile(

delete require.cache[configFile];

return Promise.resolve(interopDefault(require(configFile)))
return Promise.resolve(require(configFile))
.then(configFileContent => {
if (configFileContent.default) configFileContent = configFileContent.default;
if (typeof configFileContent === 'function') {
return configFileContent(commandOptions);
}
Expand Down

0 comments on commit dba1438

Please sign in to comment.