Unverified Commit 5e2ac098 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

chore: externalize undici for bundling (#64209)

Currently acornjs has an issue with compiling undici, add undici
externalize, once it's resolved we can remove the externalization for it

```
You may need an additional loader to handle the result of these loaders.
|       // 5. If object is not a default iterator object for interface,
|       //    then throw a TypeError.
>       if (typeof this !== 'object' || this === null || !(#target in this)) {
|         throw new TypeError(
|           `'next' called on an object that does not implement interface ${name} Iterator.`

Import trace for requested module:
../../../../node_modules/.pnpm/undici@6.12.0/node_modules/undici/lib/web/fetch/util.js
../../../../node_modules/.pnpm/undici@6.12.0/node_modules/undici/lib/web/fetch/headers.js
../../../../node_modules/.pnpm/undici@6.12.0/node_modules/undici/index.js
./app/undici/page.js
```

Closes NEXT-3030
parent 9638b9d4
...@@ -68,6 +68,7 @@ Next.js includes a [short list of popular packages](https://github.com/vercel/ne ...@@ -68,6 +68,7 @@ Next.js includes a [short list of popular packages](https://github.com/vercel/ne
- `ts-node` - `ts-node`
- `typescript` - `typescript`
- `vscode-oniguruma` - `vscode-oniguruma`
- `undici`
- `webpack` - `webpack`
- `websocket` - `websocket`
- `zeromq` - `zeromq`
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
"tailwindcss", "tailwindcss",
"ts-node", "ts-node",
"typescript", "typescript",
"undici",
"vscode-oniguruma", "vscode-oniguruma",
"webpack", "webpack",
"websocket", "websocket",
......
...@@ -21,6 +21,7 @@ createNextDescribe( ...@@ -21,6 +21,7 @@ createNextDescribe(
files: __dirname, files: __dirname,
dependencies: { dependencies: {
swr: 'latest', swr: 'latest',
undici: 'latest',
}, },
packageJson: { packageJson: {
scripts: { scripts: {
......
import { request } from 'undici'
export default async function Page() {
const { statusCode } = await request('https://example.com')
return <div>status: {statusCode}</div>
}
export const dynamic = 'force-dynamic'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment