diff --git a/packages/next/src/build/webpack-config.ts b/packages/next/src/build/webpack-config.ts index fc1105a5a79f1..a4711bc4b9a07 100644 --- a/packages/next/src/build/webpack-config.ts +++ b/packages/next/src/build/webpack-config.ts @@ -844,6 +844,8 @@ export default async function getBaseWebpackConfig( const aliasCodeConditionTest = [codeCondition.test, pageExtensionsRegex] + const builtinModules = require('module').builtinModules + let webpackConfig: webpack.Configuration = { parallelism: Number(process.env.NEXT_WEBPACK_PARALLELISM) || undefined, ...(isNodeServer ? { externalsPresets: { node: true } } : {}), @@ -867,6 +869,7 @@ export default async function getBaseWebpackConfig( : []), ] : [ + ...builtinModules, ({ context, request, diff --git a/test/development/basic/node-builtins/app/server-component/page.js b/test/development/basic/node-builtins/app/server-component/page.js index a995bd45e81f4..7ab8f00e5384a 100644 --- a/test/development/basic/node-builtins/app/server-component/page.js +++ b/test/development/basic/node-builtins/app/server-component/page.js @@ -18,6 +18,8 @@ import timers from 'timers' import tty from 'tty' import util from 'util' import zlib from 'zlib' + +import '_http_common' import 'setimmediate' async function getData() {