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 undici warning in Node.js 18 #42477

Merged
merged 6 commits into from Nov 4, 2022
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 3 additions & 9 deletions packages/next/server/config.ts
Expand Up @@ -57,17 +57,11 @@ const experimentalWarning = execOnce(
}
)

// TODO-APP: the type of this is wrong. In worker.ts it's called with only a fraction of the config, not the full config object.
export function setHttpClientAndAgentOptions(config: NextConfig) {
ijjk marked this conversation as resolved.
Show resolved Hide resolved
if (isAboveNodejs16) {
if (
config.experimental?.enableUndici &&
!config.experimental?.appDir &&
isAboveNodejs18
) {
Log.warn(
`\`enableUndici\` option is unnecessary in Node.js v${NODE_18_VERSION} or greater.`
)
} else {
// Node.js 18 has undici built-in.
if (config.experimental?.enableUndici && !isAboveNodejs18) {
// When appDir is enabled undici is the default because of Response.clone() issues in node-fetch
;(global as any).__NEXT_USE_UNDICI = config.experimental?.enableUndici
}
Expand Down