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
e8fed69a
Commit
e8fed69a
authored
Nov 07, 2025
by
Jiachi Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: skip collecting metadata for app-error in webpack (#85892)
parent
14034b70
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
5 deletions
+53
-5
index.ts
...s/next/src/build/webpack/loaders/next-app-loader/index.ts
+8
-5
layout.tsx
test/production/app-dir/metadata-base-warning/app/layout.tsx
+19
-0
opengraph-image.png
...ion/app-dir/metadata-base-warning/app/opengraph-image.png
+0
-0
page.tsx
test/production/app-dir/metadata-base-warning/app/page.tsx
+7
-0
metadata-base-warning.test.ts
...p-dir/metadata-base-warning/metadata-base-warning.test.ts
+13
-0
next.config.js
test/production/app-dir/metadata-base-warning/next.config.js
+6
-0
No files found.
packages/next/src/build/webpack/loaders/next-app-loader/index.ts
View file @
e8fed69a
...
@@ -38,6 +38,7 @@ import { PARALLEL_ROUTE_DEFAULT_PATH } from '../../../../client/components/built
...
@@ -38,6 +38,7 @@ import { PARALLEL_ROUTE_DEFAULT_PATH } from '../../../../client/components/built
import
type
{
Compilation
}
from
'webpack'
import
type
{
Compilation
}
from
'webpack'
import
{
createAppRouteCode
}
from
'./create-app-route-code'
import
{
createAppRouteCode
}
from
'./create-app-route-code'
import
{
MissingDefaultParallelRouteError
}
from
'../../../../shared/lib/errors/missing-default-parallel-route-error'
import
{
MissingDefaultParallelRouteError
}
from
'../../../../shared/lib/errors/missing-default-parallel-route-error'
import
{
normalizePathSep
}
from
'../../../../shared/lib/page-path/normalize-path-sep'
export
type
AppLoaderOptions
=
{
export
type
AppLoaderOptions
=
{
name
:
string
name
:
string
...
@@ -87,7 +88,7 @@ const PARALLEL_VIRTUAL_SEGMENT = 'slot$'
...
@@ -87,7 +88,7 @@ const PARALLEL_VIRTUAL_SEGMENT = 'slot$'
const
defaultGlobalErrorPath
=
const
defaultGlobalErrorPath
=
'next/dist/client/components/builtin/global-error.js'
'next/dist/client/components/builtin/global-error.js'
const
defaultNotFoundPath
=
'next/dist/client/components/builtin/not-found.js'
const
defaultNotFoundPath
=
'next/dist/client/components/builtin/not-found.js'
const
defaultEmptyStubPath
=
'next/dist/client/components/builtin/empty-stub'
const
defaultEmptyStubPath
=
'next/dist/client/components/builtin/empty-stub
.js
'
const
defaultLayoutPath
=
'next/dist/client/components/builtin/layout.js'
const
defaultLayoutPath
=
'next/dist/client/components/builtin/layout.js'
const
defaultGlobalNotFoundPath
=
const
defaultGlobalNotFoundPath
=
'next/dist/client/components/builtin/global-not-found.js'
'next/dist/client/components/builtin/global-not-found.js'
...
@@ -176,9 +177,7 @@ async function createTreeCodeFromPath(
...
@@ -176,9 +177,7 @@ async function createTreeCodeFromPath(
async
function
resolveAdjacentParallelSegments
(
async
function
resolveAdjacentParallelSegments
(
segmentPath
:
string
segmentPath
:
string
):
Promise
<
string
[]
>
{
):
Promise
<
string
[]
>
{
const
absoluteSegmentPath
=
await
resolveDir
(
const
absoluteSegmentPath
=
resolveDir
(
`
${
appDirPrefix
}${
segmentPath
}
`
)
`
${
appDirPrefix
}${
segmentPath
}
`
)
if
(
!
absoluteSegmentPath
)
{
if
(
!
absoluteSegmentPath
)
{
return
[]
return
[]
...
@@ -232,7 +231,11 @@ async function createTreeCodeFromPath(
...
@@ -232,7 +231,11 @@ async function createTreeCodeFromPath(
const
routerDirPath
=
`
${
appDirPrefix
}${
segmentPath
}
`
const
routerDirPath
=
`
${
appDirPrefix
}${
segmentPath
}
`
const
resolvedRouteDir
=
resolveDir
(
routerDirPath
)
const
resolvedRouteDir
=
resolveDir
(
routerDirPath
)
if
(
resolvedRouteDir
)
{
if
(
resolvedRouteDir
&&
// Do not collect metadata for app-error route as it's for generating pure static 500.html
!
normalizePathSep
(
pagePath
).
endsWith
(
appErrorPath
)
)
{
metadata
=
await
createStaticMetadataFromRoute
(
resolvedRouteDir
,
{
metadata
=
await
createStaticMetadataFromRoute
(
resolvedRouteDir
,
{
basePath
,
basePath
,
segment
:
segmentPath
,
segment
:
segmentPath
,
...
...
test/production/app-dir/metadata-base-warning/app/layout.tsx
0 → 100644
View file @
e8fed69a
import
type
{
Metadata
}
from
'next'
export
const
metadata
:
Metadata
=
{
title
:
'my title'
,
description
:
'my description'
,
metadataBase
:
'https://my-domain.com/'
,
}
export
default
function
RootLayout
({
children
,
}:
Readonly
<
{
children
:
React
.
ReactNode
}
>
)
{
return
(
<
html
>
<
body
>
{
children
}
</
body
>
</
html
>
)
}
test/production/app-dir/metadata-base-warning/app/opengraph-image.png
0 → 100644
View file @
e8fed69a
1.62 KB
test/production/app-dir/metadata-base-warning/app/page.tsx
0 → 100644
View file @
e8fed69a
export
default
function
Home
()
{
return
(
<
div
>
<
h1
>
Hello World
</
h1
>
</
div
>
)
}
test/production/app-dir/metadata-base-warning/metadata-base-warning.test.ts
0 → 100644
View file @
e8fed69a
import
{
nextTestSetup
}
from
'e2e-utils'
describe
(
'metadata-base-warning'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
files
:
__dirname
,
})
it
(
'should not warn metadataBase for static image when metadataBase is set'
,
async
()
=>
{
expect
(
next
.
cliOutput
).
not
.
toContain
(
'metadataBase property in metadata export is not set for resolving social open graph or twitter images'
)
})
})
test/production/app-dir/metadata-base-warning/next.config.js
0 → 100644
View file @
e8fed69a
/**
* @type {import('next').NextConfig}
*/
const
nextConfig
=
{}
module
.
exports
=
nextConfig
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