Skip to content

Commit 8ed9499

Browse files
authored
Fix mistakenly identifying files as using commonjs when they weren't (#7153)
1 parent e892570 commit 8ed9499

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/gatsby/src/bootstrap/resolve-module-exports.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ module.exports = (modulePath, resolver = require.resolve) => {
4747
if (exportName) exportNames.push(exportName)
4848
},
4949
AssignmentExpression: function AssignmentExpression(astPath) {
50-
isCommonJS = true
5150
const nodeLeft = astPath.node.left
5251

5352
if (nodeLeft.type !== `MemberExpression`) return
5453

5554
// get foo from `exports.foo = bar`
5655
if (get(nodeLeft, `object.name`) === `exports`) {
56+
isCommonJS = true
5757
exportNames.push(nodeLeft.property.name)
5858
}
5959

@@ -62,6 +62,7 @@ module.exports = (modulePath, resolver = require.resolve) => {
6262
get(nodeLeft, `object.object.name`) === `module` &&
6363
get(nodeLeft, `object.property.name`) === `exports`
6464
) {
65+
isCommonJS = true
6566
exportNames.push(nodeLeft.property.name)
6667
}
6768
},

0 commit comments

Comments
 (0)