Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby): support builtin modules prefixed with node: on build-html #38516

Merged
merged 11 commits into from
Jan 3, 2024
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