Skip to content

Commit

Permalink
fix(gatsby): support builtin modules prefixed with node: on `build-…
Browse files Browse the repository at this point in the history
…html` (#38516) (#38818)

(cherry picked from commit a08c8a0)

Co-authored-by: Chitoku <chitoku-k@users.noreply.github.com>
  • Loading branch information
gatsbybot and chitoku-k authored Jan 23, 2024
1 parent c9f8c24 commit c74745c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/gatsby/src/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -872,14 +872,17 @@ module.exports = async (
const builtinsExternalsDictionary = builtinModules.reduce(
(acc, builtinModule) => {
if (builtinModulesToTrack.includes(builtinModule)) {
acc[builtinModule] = `commonjs ${path.join(
const builtinModuleTracked = path.join(
program.directory,
`.cache`,
`ssr-builtin-trackers`,
builtinModule
)}`
)
acc[builtinModule] = `commonjs ${builtinModuleTracked}`
acc[`node:${builtinModule}`] = `commonjs ${builtinModuleTracked}`
} else {
acc[builtinModule] = `commonjs ${builtinModule}`
acc[`node:${builtinModule}`] = `commonjs ${builtinModule}`
}
return acc
},
Expand Down

0 comments on commit c74745c

Please sign in to comment.