diff --git a/docs/02-app/02-api-reference/05-next-config-js/serverComponentsExternalPackages.mdx b/docs/02-app/02-api-reference/05-next-config-js/serverComponentsExternalPackages.mdx index c4953d16953ac..da52a4dbe5542 100644 --- a/docs/02-app/02-api-reference/05-next-config-js/serverComponentsExternalPackages.mdx +++ b/docs/02-app/02-api-reference/05-next-config-js/serverComponentsExternalPackages.mdx @@ -68,6 +68,7 @@ Next.js includes a [short list of popular packages](https://github.com/vercel/ne - `ts-node` - `typescript` - `vscode-oniguruma` +- `undici` - `webpack` - `websocket` - `zeromq` diff --git a/packages/next/src/lib/server-external-packages.json b/packages/next/src/lib/server-external-packages.json index ce82837951780..dfcf2686b3e1c 100644 --- a/packages/next/src/lib/server-external-packages.json +++ b/packages/next/src/lib/server-external-packages.json @@ -46,6 +46,7 @@ "tailwindcss", "ts-node", "typescript", + "undici", "vscode-oniguruma", "webpack", "websocket", diff --git a/test/e2e/app-dir/app-external/app-external.test.ts b/test/e2e/app-dir/app-external/app-external.test.ts index 7fcf4db13cc46..bfbdbc4fc703d 100644 --- a/test/e2e/app-dir/app-external/app-external.test.ts +++ b/test/e2e/app-dir/app-external/app-external.test.ts @@ -21,6 +21,7 @@ createNextDescribe( files: __dirname, dependencies: { swr: 'latest', + undici: 'latest', }, packageJson: { scripts: { diff --git a/test/e2e/app-dir/app-external/app/undici/page.js b/test/e2e/app-dir/app-external/app/undici/page.js new file mode 100644 index 0000000000000..2171c2cdced39 --- /dev/null +++ b/test/e2e/app-dir/app-external/app/undici/page.js @@ -0,0 +1,8 @@ +import { request } from 'undici' + +export default async function Page() { + const { statusCode } = await request('https://example.com') + return
status: {statusCode}
+} + +export const dynamic = 'force-dynamic'