From 990ef2c9ffb170b89a2b4f1e26f2853e8c3597c1 Mon Sep 17 00:00:00 2001 From: Chitoku Date: Sun, 3 Sep 2023 19:06:38 +0900 Subject: [PATCH] fix(gatsby): support builtin modules prefixed with `node:` on `build-html` --- packages/gatsby/src/utils/webpack.config.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/gatsby/src/utils/webpack.config.js b/packages/gatsby/src/utils/webpack.config.js index 1be2b316ddbff..5938b1adad3fc 100644 --- a/packages/gatsby/src/utils/webpack.config.js +++ b/packages/gatsby/src/utils/webpack.config.js @@ -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 },