Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
164ccd1c
Commit
164ccd1c
authored
Feb 08, 2026
by
Jimmy Lai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tree shake correctly
parent
22c23392
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
22 deletions
+33
-22
errors.json
packages/next/errors.json
+2
-1
debug-channel-server.ts
packages/next/src/server/app-render/debug-channel-server.ts
+27
-20
pipeable-stream-wrappers.ts
...es/next/src/server/app-render/pipeable-stream-wrappers.ts
+4
-1
No files found.
packages/next/errors.json
View file @
164ccd1c
...
@@ -1055,5 +1055,6 @@
...
@@ -1055,5 +1055,6 @@
"1054"
:
"processNodePrelude is not supported in edge runtime"
,
"1054"
:
"processNodePrelude is not supported in edge runtime"
,
"1055"
:
"createUnclosingNodeStream is not supported in edge runtime"
,
"1055"
:
"createUnclosingNodeStream is not supported in edge runtime"
,
"1056"
:
"createClosingNodeStream is not supported in edge runtime"
,
"1056"
:
"createClosingNodeStream is not supported in edge runtime"
,
"1057"
:
"Cannot tee a Node.js stream in the edge runtime"
"1057"
:
"Cannot tee a Node.js stream in the edge runtime"
,
"1058"
:
"toNodeDebugChannel can only be used in Node.js environments, this is a bug in the Next.js codebase"
}
}
packages/next/src/server/app-render/debug-channel-server.ts
View file @
164ccd1c
...
@@ -25,26 +25,33 @@ export type DebugChannelClient = {
...
@@ -25,26 +25,33 @@ export type DebugChannelClient = {
export
function
toNodeDebugChannel
(
export
function
toNodeDebugChannel
(
webDebugChannel
:
DebugChannelServer
webDebugChannel
:
DebugChannelServer
):
import
(
'node:stream'
).
Writable
{
):
import
(
'node:stream'
).
Writable
{
const
{
Writable
}
=
require
(
'node:stream'
)
as
typeof
import
(
'node:stream'
)
// Guard so webpack can DCE node:stream require for edge builds.
const
writer
=
webDebugChannel
.
writable
.
getWriter
()
if
(
!
process
.
env
.
__NEXT_USE_NODE_STREAMS
)
{
return
new
Writable
({
throw
new
Error
(
write
(
'toNodeDebugChannel can only be used in Node.js environments, this is a bug in the Next.js codebase'
chunk
:
Buffer
|
Uint8Array
,
)
_encoding
:
string
,
}
else
{
callback
:
(
error
?:
Error
|
null
)
=>
void
const
{
Writable
}
=
require
(
'node:stream'
)
as
typeof
import
(
'node:stream'
)
)
{
const
writer
=
webDebugChannel
.
writable
.
getWriter
()
writer
.
write
(
chunk
).
then
(()
=>
callback
(),
callback
)
return
new
Writable
({
},
write
(
final
(
callback
:
(
error
?:
Error
|
null
)
=>
void
)
{
chunk
:
Buffer
|
Uint8Array
,
writer
.
close
().
then
(()
=>
callback
(),
callback
)
_encoding
:
string
,
},
callback
:
(
error
?:
Error
|
null
)
=>
void
destroy
(
_err
,
callback
)
{
)
{
writer
.
abort
(
_err
).
then
(
writer
.
write
(
chunk
).
then
(()
=>
callback
(),
callback
)
()
=>
callback
(
_err
),
},
()
=>
callback
(
_err
)
final
(
callback
:
(
error
?:
Error
|
null
)
=>
void
)
{
)
writer
.
close
().
then
(()
=>
callback
(),
callback
)
},
},
})
destroy
(
_err
,
callback
)
{
writer
.
abort
(
_err
).
then
(
()
=>
callback
(
_err
),
()
=>
callback
(
_err
)
)
},
})
}
}
}
export
function
createDebugChannel
():
DebugChannelPair
|
undefined
{
export
function
createDebugChannel
():
DebugChannelPair
|
undefined
{
...
...
packages/next/src/server/app-render/pipeable-stream-wrappers.ts
View file @
164ccd1c
...
@@ -156,7 +156,10 @@ export function renderToFlightPipeableStream(
...
@@ -156,7 +156,10 @@ export function renderToFlightPipeableStream(
if
(
options
?.
debugChannel
)
{
if
(
options
?.
debugChannel
)
{
const
{
toNodeDebugChannel
}
=
const
{
toNodeDebugChannel
}
=
require
(
'./debug-channel-server'
)
as
typeof
import
(
'./debug-channel-server'
)
require
(
'./debug-channel-server'
)
as
typeof
import
(
'./debug-channel-server'
)
options
=
{
...
options
,
debugChannel
:
toNodeDebugChannel
(
options
.
debugChannel
)
}
options
=
{
...
options
,
debugChannel
:
toNodeDebugChannel
(
options
.
debugChannel
),
}
}
}
const
{
pipe
}
=
renderToPipeableStreamFn
(
model
,
webpackMap
,
options
)
const
{
pipe
}
=
renderToPipeableStreamFn
(
model
,
webpackMap
,
options
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment