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
f8179386
Unverified
Commit
f8179386
authored
Feb 05, 2026
by
JJ Kasper
Committed by
GitHub
Feb 05, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure module contexts are always included in adapter traces (#89508)
parent
ab8e7865
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
35 deletions
+62
-35
build-complete.ts
packages/next/src/build/adapter/build-complete.ts
+33
-35
adapter-config.test.ts
test/production/adapter-config/adapter-config.test.ts
+29
-0
No files found.
packages/next/src/build/adapter/build-complete.ts
View file @
f8179386
...
...
@@ -532,50 +532,48 @@ export async function handleBuildComplete({
sharedNodeAssets
[
path
.
relative
(
tracingRoot
,
setupNodeStubPath
)]
=
require
.
resolve
(
'next/dist/build/adapter/setup-node-env.external'
)
if
(
bundler
!==
Bundler
.
Turbopack
)
{
const
moduleTypes
=
[
'app-page'
,
'pages'
]
as
const
const
moduleTypes
=
[
'app-page'
,
'pages'
]
as
const
for
(
const
type
of
moduleTypes
)
{
const
currentDependencies
:
string
[]
=
[]
const
modulePath
=
require
.
resolve
(
`next/dist/server/route-modules/
${
type
}
/module.compiled`
)
const
contextDir
=
path
.
join
(
path
.
dirname
(
modulePath
),
'vendored'
,
'contexts'
)
for
(
const
type
of
moduleTypes
)
{
const
currentDependencies
:
string
[]
=
[]
const
modulePath
=
require
.
resolve
(
`next/dist/server/route-modules/
${
type
}
/module.compiled`
)
currentDependencies
.
push
(
modulePath
)
for
(
const
item
of
await
fs
.
readdir
(
contextDir
))
{
if
(
item
.
match
(
/
\.(
mjs|cjs|js
)
$/
))
{
currentDependencies
.
push
(
path
.
join
(
contextDir
,
item
))
}
const
contextDir
=
path
.
join
(
path
.
dirname
(
modulePath
),
'vendored'
,
'contexts'
)
for
(
const
item
of
await
fs
.
readdir
(
contextDir
))
{
if
(
item
.
match
(
/
\.(
mjs|cjs|js
)
$/
))
{
currentDependencies
.
push
(
path
.
join
(
contextDir
,
item
))
}
}
const
{
fileList
,
esmFileList
}
=
await
nodeFileTrace
(
currentDependencies
,
{
base
:
tracingRoot
,
ignore
:
sharedIgnoreFn
,
}
for
(
const
dependencyPath
of
currentDependencies
)
{
const
rootRelativeFilePath
=
path
.
relative
(
tracingRoot
,
dependencyPath
)
esmFileList
.
forEach
((
item
)
=>
fileList
.
add
(
item
))
for
(
const
rootRelativeFilePath
of
fileList
)
{
if
(
type
===
'pages'
)
{
pagesSharedNodeAssets
[
rootRelativeFilePath
]
=
path
.
join
(
tracingRoot
,
rootRelativeFilePath
)
}
else
{
appPagesSharedNodeAssets
[
rootRelativeFilePath
]
=
path
.
join
(
tracingRoot
,
rootRelativeFilePath
)
}
if
(
type
===
'pages'
)
{
pagesSharedNodeAssets
[
rootRelativeFilePath
]
=
path
.
join
(
tracingRoot
,
rootRelativeFilePath
)
}
else
{
appPagesSharedNodeAssets
[
rootRelativeFilePath
]
=
path
.
join
(
tracingRoot
,
rootRelativeFilePath
)
}
}
}
if
(
bundler
!==
Bundler
.
Turbopack
)
{
// These are modules that are necessary for bootstrapping node env
const
necessaryNodeDependencies
=
[
require
.
resolve
(
'next/dist/server/node-environment'
),
...
...
test/production/adapter-config/adapter-config.test.ts
View file @
f8179386
...
...
@@ -173,6 +173,35 @@ describe('adapter-config', () => {
}
}
// Verify vendored context files are traced in assets for app-page and pages outputs
const
appPageOutput
=
outputs
.
appPages
.
find
(
(
output
)
=>
output
.
pathname
===
'/docs/node-app'
&&
output
.
runtime
===
'nodejs'
)
const
pagesOutput
=
outputs
.
pages
.
find
(
(
output
)
=>
output
.
pathname
===
'/docs/node-pages'
&&
output
.
runtime
===
'nodejs'
)
expect
(
appPageOutput
).
toBeDefined
()
expect
(
pagesOutput
).
toBeDefined
()
// Check that vendored context files are included in assets
const
appPageAssets
=
Object
.
values
(
appPageOutput
!
.
assets
)
const
pagesAssets
=
Object
.
values
(
pagesOutput
!
.
assets
)
const
appPageVendoredContexts
=
appPageAssets
.
filter
((
asset
)
=>
asset
.
includes
(
'vendored/contexts/'
)
)
const
pagesVendoredContexts
=
pagesAssets
.
filter
((
asset
)
=>
asset
.
includes
(
'vendored/contexts/'
)
)
// app-page should have vendored context files traced
expect
(
appPageVendoredContexts
.
length
).
toBeGreaterThan
(
0
)
// pages should have vendored context files traced
expect
(
pagesVendoredContexts
.
length
).
toBeGreaterThan
(
0
)
for
(
const
route
of
edgeOutputs
)
{
try
{
expect
(
route
.
id
).
toBeString
()
...
...
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