Skip to content

Commit

Permalink
fix(gatsby): ignore __esModule export in gatsby-node exports (gatsbyj…
Browse files Browse the repository at this point in the history
…s#13081)

I introduced bug/regression in gatsbyjs#13053 by not removing `__esModule` export name from resolved export names - it break some plugins

Fixes: gatsbyjs#13079
  • Loading branch information
pieh authored Apr 3, 2019
1 parent bb43fe0 commit 1c78ffb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/gatsby/src/bootstrap/__mocks__/require/exports.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
exports.foo = () => {}
exports.bar = () => {}
exports.__esModule = true
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ Object.defineProperty(exports, `foo`, {
return () => {}
},
})
Object.defineProperty(exports, `__esModule`, {
value: true,
})
4 changes: 3 additions & 1 deletion packages/gatsby/src/bootstrap/resolve-module-exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ https://gatsby.dev/no-mixed-modules
module.exports = (modulePath, { mode = `analysis`, resolver } = {}) => {
if (mode === `require`) {
try {
return Object.keys(require(modulePath))
return Object.keys(require(modulePath)).filter(
exportName => exportName !== `__esModule`
)
} catch {
return []
}
Expand Down

0 comments on commit 1c78ffb

Please sign in to comment.