Skip to content

Commit c998ac3

Browse files
committed
fixed an issue with external globals defined in CJS that happen to have a 'default' export
1 parent ee6cc08 commit c998ac3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/utils/requireModule.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = function (fullpath) {
1818
return import(fullpath).then(result => (result.default || {}));
1919
}
2020

21-
if (exported && Object.prototype.hasOwnProperty.call(exported, 'default')) {
21+
if (exported && Object.prototype.hasOwnProperty.call(exported, 'default') && Object.keys(exported).length === 1) {
2222
return exported.default;
2323
}
2424

test/extra/external-globals.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const assert = require('assert');
22

33
module.exports = {
4+
'default': {},
5+
46
async before() {
57
this.isFungus = true;
68
},

0 commit comments

Comments
 (0)