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

add missing node modules to externals #70382

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
14 changes: 13 additions & 1 deletion turbopack/crates/turbopack-resolve/src/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
typescript::{apply_tsconfig_resolve_options, tsconfig, tsconfig_resolve_options},
};

const NODE_EXTERNALS: [&str; 51] = [
const NODE_EXTERNALS: [&str; 63] = [
"assert",
"async_hooks",
"buffer",
Expand Down Expand Up @@ -67,6 +67,18 @@ const NODE_EXTERNALS: [&str; 51] = [
"worker_threads",
"zlib",
"pnpapi",
"_http_agent",
"_http_client",
"_http_common",
"_http_incoming",
"_http_outgoing",
"_http_server",
"_stream_duplex",
"_stream_passthrough",
"_stream_readable",
"_stream_transform",
"_stream_wrap",
"_stream_writable",
];

const EDGE_NODE_EXTERNALS: [&str; 5] = ["buffer", "events", "assert", "util", "async_hooks"];
Expand Down
Loading