Skip to content

Commit

Permalink
Merge branch 'master' into gh-2676
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Feb 15, 2019
2 parents ef84055 + f8faa4b commit 0e30a97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/src/run/loadConfigFile.ts
Expand Up @@ -10,6 +10,10 @@ 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 All @@ -33,6 +37,7 @@ export default function loadConfigFile(
}

return bundle.generate({
exports: 'named',
format: 'cjs'
});
})
Expand All @@ -49,7 +54,7 @@ export default function loadConfigFile(

delete require.cache[configFile];

return Promise.resolve(require(configFile))
return Promise.resolve(interopDefault(require(configFile)))
.then(configFileContent => {
if (typeof configFileContent === 'function') {
return configFileContent(commandOptions);
Expand Down
2 changes: 2 additions & 0 deletions test/cli/samples/config-es6/rollup.config.js
@@ -1,5 +1,7 @@
import replace from 'rollup-plugin-replace';

export const ignoresNonDefaultExports = true

export default {
input: 'main.js',
output: {
Expand Down

0 comments on commit 0e30a97

Please sign in to comment.