Skip to content

Commit

Permalink
add builtin node modules to webpack externals
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Sep 24, 2024
1 parent 8079753 commit 38d7b14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,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 } } : {}),
Expand All @@ -856,6 +858,7 @@ export default async function getBaseWebpackConfig(
: []),
]
: [
...builtinModules,
({
context,
request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 38d7b14

Please sign in to comment.