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
bc72f41a
Unverified
Commit
bc72f41a
authored
Aug 26, 2025
by
Zack Tanner
Committed by
GitHub
Aug 26, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[backport] revert: add ?dpl to fonts in `/_next/static/media` (#83062) (#83066)
Backports: - #83062
parent
c8faf680
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
21 additions
and
59 deletions
+21
-59
loader.test.ts
packages/font/src/google/loader.test.ts
+0
-1
loader.test.ts
packages/font/src/local/loader.test.ts
+0
-33
loader.ts
packages/font/src/local/loader.ts
+1
-6
index.d.ts
packages/next/font/index.d.ts
+0
-1
webpack-config.ts
packages/next/src/build/webpack-config.ts
+0
-1
next-font.ts
.../src/build/webpack/config/blocks/css/loaders/next-font.ts
+0
-1
index.ts
packages/next/src/build/webpack/config/index.ts
+0
-3
utils.ts
packages/next/src/build/webpack/config/utils.ts
+0
-1
index.ts
.../next/src/build/webpack/loaders/next-font-loader/index.ts
+1
-3
_document.tsx
packages/next/src/pages/_document.tsx
+3
-5
get-layer-assets.tsx
packages/next/src/server/app-render/get-layer-assets.tsx
+1
-1
deployment-id-cookie-handling.test.ts
...loyment-id-handling/deployment-id-cookie-handling.test.ts
+5
-1
deployment-id-handling.test.ts
...ion/deployment-id-handling/deployment-id-handling.test.ts
+10
-2
No files found.
packages/font/src/google/loader.test.ts
View file @
bc72f41a
...
@@ -124,7 +124,6 @@ describe('next/font/google loader', () => {
...
@@ -124,7 +124,6 @@ describe('next/font/google loader', () => {
mockFetchResource
.
mockResolvedValue
(
Buffer
.
from
(
'OK'
))
mockFetchResource
.
mockResolvedValue
(
Buffer
.
from
(
'OK'
))
const
{
css
}
=
await
nextFontGoogleFontLoader
({
const
{
css
}
=
await
nextFontGoogleFontLoader
({
functionName
,
functionName
,
deploymentId
:
undefined
,
data
:
[
data
:
[
{
{
adjustFontFallback
:
false
,
adjustFontFallback
:
false
,
...
...
packages/font/src/local/loader.test.ts
View file @
bc72f41a
...
@@ -5,7 +5,6 @@ describe('next/font/local loader', () => {
...
@@ -5,7 +5,6 @@ describe('next/font/local loader', () => {
test
(
'Default CSS'
,
async
()
=>
{
test
(
'Default CSS'
,
async
()
=>
{
const
{
css
}
=
await
nextFontLocalFontLoader
({
const
{
css
}
=
await
nextFontLocalFontLoader
({
functionName
:
''
,
functionName
:
''
,
deploymentId
:
undefined
,
data
:
[{
src
:
'./my-font.woff2'
}],
data
:
[{
src
:
'./my-font.woff2'
}],
emitFontFile
:
()
=>
'/_next/static/media/my-font.woff2'
,
emitFontFile
:
()
=>
'/_next/static/media/my-font.woff2'
,
resolve
:
jest
.
fn
(),
resolve
:
jest
.
fn
(),
...
@@ -29,37 +28,9 @@ describe('next/font/local loader', () => {
...
@@ -29,37 +28,9 @@ describe('next/font/local loader', () => {
`
)
`
)
})
})
test
(
'with dpl query string'
,
async
()
=>
{
const
{
css
}
=
await
nextFontLocalFontLoader
({
functionName
:
''
,
deploymentId
:
'dpl_123'
,
data
:
[{
src
:
'./my-font.woff2'
}],
emitFontFile
:
()
=>
'/_next/static/media/my-font.woff2'
,
resolve
:
jest
.
fn
(),
isDev
:
false
,
isServer
:
true
,
variableName
:
'myFont'
,
loaderContext
:
{
fs
:
{
readFile
:
(
_
:
string
,
cb
:
any
)
=>
cb
(
null
,
'fontdata'
),
},
}
as
any
,
})
expect
(
css
).
toMatchInlineSnapshot
(
`
"@font-face {
font-family: myFont;
src: url(/_next/static/media/my-font.woff2?dpl=dpl_123) format('woff2');
font-display: swap;
}
"
`
)
})
test
(
'Weight and style'
,
async
()
=>
{
test
(
'Weight and style'
,
async
()
=>
{
const
{
css
}
=
await
nextFontLocalFontLoader
({
const
{
css
}
=
await
nextFontLocalFontLoader
({
functionName
:
''
,
functionName
:
''
,
deploymentId
:
undefined
,
data
:
[{
src
:
'./my-font.woff2'
,
weight
:
'100 900'
,
style
:
'italic'
}],
data
:
[{
src
:
'./my-font.woff2'
,
weight
:
'100 900'
,
style
:
'italic'
}],
emitFontFile
:
()
=>
'/_next/static/media/my-font.woff2'
,
emitFontFile
:
()
=>
'/_next/static/media/my-font.woff2'
,
resolve
:
jest
.
fn
(),
resolve
:
jest
.
fn
(),
...
@@ -88,7 +59,6 @@ describe('next/font/local loader', () => {
...
@@ -88,7 +59,6 @@ describe('next/font/local loader', () => {
test
(
'Other properties'
,
async
()
=>
{
test
(
'Other properties'
,
async
()
=>
{
const
{
css
}
=
await
nextFontLocalFontLoader
({
const
{
css
}
=
await
nextFontLocalFontLoader
({
functionName
:
''
,
functionName
:
''
,
deploymentId
:
undefined
,
data
:
[
data
:
[
{
{
src
:
'./my-font.woff2'
,
src
:
'./my-font.woff2'
,
...
@@ -125,7 +95,6 @@ describe('next/font/local loader', () => {
...
@@ -125,7 +95,6 @@ describe('next/font/local loader', () => {
test
(
'Multiple weights default style'
,
async
()
=>
{
test
(
'Multiple weights default style'
,
async
()
=>
{
const
{
css
}
=
await
nextFontLocalFontLoader
({
const
{
css
}
=
await
nextFontLocalFontLoader
({
functionName
:
''
,
functionName
:
''
,
deploymentId
:
undefined
,
data
:
[
data
:
[
{
{
style
:
'italic'
,
style
:
'italic'
,
...
@@ -202,7 +171,6 @@ describe('next/font/local loader', () => {
...
@@ -202,7 +171,6 @@ describe('next/font/local loader', () => {
test
(
'Multiple styles default weight'
,
async
()
=>
{
test
(
'Multiple styles default weight'
,
async
()
=>
{
const
{
css
}
=
await
nextFontLocalFontLoader
({
const
{
css
}
=
await
nextFontLocalFontLoader
({
functionName
:
''
,
functionName
:
''
,
deploymentId
:
undefined
,
data
:
[
data
:
[
{
{
weight
:
'400'
,
weight
:
'400'
,
...
@@ -265,7 +233,6 @@ describe('next/font/local loader', () => {
...
@@ -265,7 +233,6 @@ describe('next/font/local loader', () => {
test
(
'Custom font-family in declarations'
,
async
()
=>
{
test
(
'Custom font-family in declarations'
,
async
()
=>
{
const
{
css
}
=
await
nextFontLocalFontLoader
({
const
{
css
}
=
await
nextFontLocalFontLoader
({
functionName
:
''
,
functionName
:
''
,
deploymentId
:
undefined
,
data
:
[
data
:
[
{
{
src
:
'./my-font.woff2'
,
src
:
'./my-font.woff2'
,
...
...
packages/font/src/local/loader.ts
View file @
bc72f41a
...
@@ -19,7 +19,6 @@ const nextFontLocalFontLoader: FontLoader = async ({
...
@@ -19,7 +19,6 @@ const nextFontLocalFontLoader: FontLoader = async ({
data
,
data
,
emitFontFile
,
emitFontFile
,
resolve
,
resolve
,
deploymentId
,
loaderContext
,
loaderContext
,
})
=>
{
})
=>
{
const
{
const
{
...
@@ -46,10 +45,6 @@ const nextFontLocalFontLoader: FontLoader = async ({
...
@@ -46,10 +45,6 @@ const nextFontLocalFontLoader: FontLoader = async ({
preload
,
preload
,
typeof
adjustFontFallback
===
'undefined'
||
!!
adjustFontFallback
typeof
adjustFontFallback
===
'undefined'
||
!!
adjustFontFallback
)
)
// Should match behavior in get-asset-query-string.ts
const
qs
=
deploymentId
?
`
${
fontUrl
.
includes
(
'?'
)
?
'&'
:
'?'
}
dpl=
${
deploymentId
}
`
:
''
// Try to load font metadata from the font file using fontkit.
// Try to load font metadata from the font file using fontkit.
// The data is used to calculate the fallback font override values.
// The data is used to calculate the fallback font override values.
...
@@ -71,7 +66,7 @@ const nextFontLocalFontLoader: FontLoader = async ({
...
@@ -71,7 +66,7 @@ const nextFontLocalFontLoader: FontLoader = async ({
?
declarations
.
map
(({
prop
,
value
})
=>
[
prop
,
value
])
?
declarations
.
map
(({
prop
,
value
})
=>
[
prop
,
value
])
:
[]),
:
[]),
...(
hasCustomFontFamily
?
[]
:
[[
'font-family'
,
variableName
]]),
...(
hasCustomFontFamily
?
[]
:
[[
'font-family'
,
variableName
]]),
[
'src'
,
`url(
${
fontUrl
+
qs
}
) format('
${
format
}
')`
],
[
'src'
,
`url(
${
fontUrl
}
) format('
${
format
}
')`
],
[
'font-display'
,
display
],
[
'font-display'
,
display
],
...(
weight
??
defaultWeight
...(
weight
??
defaultWeight
?
[[
'font-weight'
,
weight
??
defaultWeight
]]
?
[[
'font-weight'
,
weight
??
defaultWeight
]]
...
...
packages/next/font/index.d.ts
View file @
bc72f41a
...
@@ -19,7 +19,6 @@ export type FontLoader = (options: {
...
@@ -19,7 +19,6 @@ export type FontLoader = (options: {
resolve
:
(
src
:
string
)
=>
string
resolve
:
(
src
:
string
)
=>
string
isDev
:
boolean
isDev
:
boolean
isServer
:
boolean
isServer
:
boolean
deploymentId
:
string
|
undefined
loaderContext
:
any
loaderContext
:
any
})
=>
Promise
<
{
})
=>
Promise
<
{
css
:
string
css
:
string
...
...
packages/next/src/build/webpack-config.ts
View file @
bc72f41a
...
@@ -2451,7 +2451,6 @@ export default async function getBaseWebpackConfig(
...
@@ -2451,7 +2451,6 @@ export default async function getBaseWebpackConfig(
isEdgeRuntime
:
isEdgeServer
,
isEdgeRuntime
:
isEdgeServer
,
targetWeb
:
isClient
||
isEdgeServer
,
targetWeb
:
isClient
||
isEdgeServer
,
assetPrefix
:
config
.
assetPrefix
||
''
,
assetPrefix
:
config
.
assetPrefix
||
''
,
deploymentId
:
config
.
deploymentId
,
sassOptions
:
config
.
sassOptions
,
sassOptions
:
config
.
sassOptions
,
productionBrowserSourceMaps
:
config
.
productionBrowserSourceMaps
,
productionBrowserSourceMaps
:
config
.
productionBrowserSourceMaps
,
future
:
config
.
future
,
future
:
config
.
future
,
...
...
packages/next/src/build/webpack/config/blocks/css/loaders/next-font.ts
View file @
bc72f41a
...
@@ -62,7 +62,6 @@ export function getNextFontLoader(
...
@@ -62,7 +62,6 @@ export function getNextFontLoader(
isDev
:
ctx
.
isDevelopment
,
isDev
:
ctx
.
isDevelopment
,
isServer
:
ctx
.
isServer
,
isServer
:
ctx
.
isServer
,
assetPrefix
:
ctx
.
assetPrefix
,
assetPrefix
:
ctx
.
assetPrefix
,
deploymentId
:
ctx
.
deploymentId
,
fontLoaderPath
,
fontLoaderPath
,
postcss
,
postcss
,
},
},
...
...
packages/next/src/build/webpack/config/index.ts
View file @
bc72f41a
...
@@ -19,7 +19,6 @@ export async function buildConfiguration(
...
@@ -19,7 +19,6 @@ export async function buildConfiguration(
isEdgeRuntime
,
isEdgeRuntime
,
targetWeb
,
targetWeb
,
assetPrefix
,
assetPrefix
,
deploymentId
,
sassOptions
,
sassOptions
,
productionBrowserSourceMaps
,
productionBrowserSourceMaps
,
future
,
future
,
...
@@ -37,7 +36,6 @@ export async function buildConfiguration(
...
@@ -37,7 +36,6 @@ export async function buildConfiguration(
isEdgeRuntime
:
boolean
isEdgeRuntime
:
boolean
targetWeb
:
boolean
targetWeb
:
boolean
assetPrefix
:
string
assetPrefix
:
string
deploymentId
:
string
|
undefined
sassOptions
:
any
sassOptions
:
any
productionBrowserSourceMaps
:
boolean
productionBrowserSourceMaps
:
boolean
transpilePackages
:
NextConfigComplete
[
'transpilePackages'
]
transpilePackages
:
NextConfigComplete
[
'transpilePackages'
]
...
@@ -63,7 +61,6 @@ export async function buildConfiguration(
...
@@ -63,7 +61,6 @@ export async function buildConfiguration(
?
assetPrefix
.
slice
(
0
,
-
1
)
?
assetPrefix
.
slice
(
0
,
-
1
)
:
assetPrefix
:
assetPrefix
:
''
,
:
''
,
deploymentId
,
sassOptions
,
sassOptions
,
productionBrowserSourceMaps
,
productionBrowserSourceMaps
,
transpilePackages
,
transpilePackages
,
...
...
packages/next/src/build/webpack/config/utils.ts
View file @
bc72f41a
...
@@ -19,7 +19,6 @@ export type ConfigurationContext = {
...
@@ -19,7 +19,6 @@ export type ConfigurationContext = {
targetWeb
:
boolean
targetWeb
:
boolean
assetPrefix
:
string
assetPrefix
:
string
deploymentId
:
string
|
undefined
sassOptions
:
any
sassOptions
:
any
productionBrowserSourceMaps
:
boolean
productionBrowserSourceMaps
:
boolean
...
...
packages/next/src/build/webpack/loaders/next-font-loader/index.ts
View file @
bc72f41a
...
@@ -45,7 +45,6 @@ export default async function nextFontLoader(this: any) {
...
@@ -45,7 +45,6 @@ export default async function nextFontLoader(this: any) {
assetPrefix
,
assetPrefix
,
fontLoaderPath
,
fontLoaderPath
,
postcss
:
getPostcss
,
postcss
:
getPostcss
,
deploymentId
,
}
=
this
.
getOptions
()
}
=
this
.
getOptions
()
if
(
assetPrefix
&&
!
/^
\/
|https
?
:
\/\/
/
.
test
(
assetPrefix
))
{
if
(
assetPrefix
&&
!
/^
\/
|https
?
:
\/\/
/
.
test
(
assetPrefix
))
{
...
@@ -67,7 +66,7 @@ export default async function nextFontLoader(this: any) {
...
@@ -67,7 +66,7 @@ export default async function nextFontLoader(this: any) {
* NextFontManifestPlugin uses this to see if fallback fonts are being used.
* NextFontManifestPlugin uses this to see if fallback fonts are being used.
* This is used to collect stats on fallback fonts usage by the Google Aurora team.
* This is used to collect stats on fallback fonts usage by the Google Aurora team.
*/
*/
const
emitFontFile
:
Parameters
<
FontLoader
>
[
0
][
'emitFontFile'
]
=
(
const
emitFontFile
=
(
content
:
Buffer
,
content
:
Buffer
,
ext
:
string
,
ext
:
string
,
preload
:
boolean
,
preload
:
boolean
,
...
@@ -110,7 +109,6 @@ export default async function nextFontLoader(this: any) {
...
@@ -110,7 +109,6 @@ export default async function nextFontLoader(this: any) {
),
),
isDev
,
isDev
,
isServer
,
isServer
,
deploymentId
,
loaderContext
:
this
,
loaderContext
:
this
,
})
})
)
)
...
...
packages/next/src/pages/_document.tsx
View file @
bc72f41a
...
@@ -363,8 +363,7 @@ function getAmpPath(ampPath: string, asPath: string): string {
...
@@ -363,8 +363,7 @@ function getAmpPath(ampPath: string, asPath: string): string {
function
getNextFontLinkTags
(
function
getNextFontLinkTags
(
nextFontManifest
:
DeepReadonly
<
NextFontManifest
>
|
undefined
,
nextFontManifest
:
DeepReadonly
<
NextFontManifest
>
|
undefined
,
dangerousAsPath
:
string
,
dangerousAsPath
:
string
,
assetPrefix
:
string
=
''
,
assetPrefix
:
string
=
''
assetQueryString
:
string
=
''
)
{
)
{
if
(
!
nextFontManifest
)
{
if
(
!
nextFontManifest
)
{
return
{
return
{
...
@@ -404,7 +403,7 @@ function getNextFontLinkTags(
...
@@ -404,7 +403,7 @@ function getNextFontLinkTags(
<
link
<
link
key=
{
fontFile
}
key=
{
fontFile
}
rel=
"preload"
rel=
"preload"
href=
{
`${assetPrefix}/_next/${encodeURIPath(fontFile)}
${assetQueryString}
`
}
href=
{
`${assetPrefix}/_next/${encodeURIPath(fontFile)}`
}
as=
"font"
as=
"font"
type=
{
`font/${ext}`
}
type=
{
`font/${ext}`
}
crossOrigin=
"anonymous"
crossOrigin=
"anonymous"
...
@@ -756,8 +755,7 @@ export class Head extends React.Component<HeadProps> {
...
@@ -756,8 +755,7 @@ export class Head extends React.Component<HeadProps> {
const
nextFontLinkTags
=
getNextFontLinkTags
(
const
nextFontLinkTags
=
getNextFontLinkTags
(
nextFontManifest
,
nextFontManifest
,
dangerousAsPath
,
dangerousAsPath
,
assetPrefix
,
assetPrefix
this
.
context
.
assetQueryString
)
)
const
tracingMetadata
=
getTracedMetadata
(
const
tracingMetadata
=
getTracedMetadata
(
...
...
packages/next/src/server/app-render/get-layer-assets.tsx
View file @
bc72f41a
...
@@ -46,7 +46,7 @@ export function getLayerAssets({
...
@@ -46,7 +46,7 @@ export function getLayerAssets({
const
fontFilename
=
preloadedFontFiles
[
i
]
const
fontFilename
=
preloadedFontFiles
[
i
]
const
ext
=
/
\.(
woff|woff2|eot|ttf|otf
)
$/
.
exec
(
fontFilename
)
!
[
1
]
const
ext
=
/
\.(
woff|woff2|eot|ttf|otf
)
$/
.
exec
(
fontFilename
)
!
[
1
]
const
type
=
`font/
${
ext
}
`
const
type
=
`font/
${
ext
}
`
const
href
=
`
${
ctx
.
assetPrefix
}
/_next/
${
encodeURIPath
(
fontFilename
)}
${
getAssetQueryString
(
ctx
,
false
)}
`
const
href
=
`
${
ctx
.
assetPrefix
}
/_next/
${
encodeURIPath
(
fontFilename
)}
`
preloadCallbacks
.
push
(()
=>
{
preloadCallbacks
.
push
(()
=>
{
ctx
.
componentMod
.
preloadFont
(
ctx
.
componentMod
.
preloadFont
(
...
...
test/production/deployment-id-handling/deployment-id-cookie-handling.test.ts
View file @
bc72f41a
...
@@ -45,7 +45,11 @@ describe('deployment-id-handling disabled', () => {
...
@@ -45,7 +45,11 @@ describe('deployment-id-handling disabled', () => {
for
(
const
link
of
links
)
{
for
(
const
link
of
links
)
{
if
(
link
.
attribs
.
href
)
{
if
(
link
.
attribs
.
href
)
{
if
(
link
.
attribs
.
as
===
'font'
)
{
expect
(
link
.
attribs
.
href
).
not
.
toContain
(
'dpl='
+
deploymentId
)
expect
(
link
.
attribs
.
href
).
not
.
toContain
(
'dpl='
+
deploymentId
)
}
else
{
expect
(
link
.
attribs
.
href
).
not
.
toContain
(
'dpl='
+
deploymentId
)
}
}
}
}
}
...
...
test/production/deployment-id-handling/deployment-id-handling.test.ts
View file @
bc72f41a
...
@@ -39,9 +39,13 @@ describe.each(['NEXT_DEPLOYMENT_ID', 'CUSTOM_DEPLOYMENT_ID'])(
...
@@ -39,9 +39,13 @@ describe.each(['NEXT_DEPLOYMENT_ID', 'CUSTOM_DEPLOYMENT_ID'])(
for
(
const
link
of
links
)
{
for
(
const
link
of
links
)
{
if
(
link
.
attribs
.
href
&&
link
.
attribs
.
rel
!==
'expect'
)
{
if
(
link
.
attribs
.
href
&&
link
.
attribs
.
rel
!==
'expect'
)
{
if
(
link
.
attribs
.
as
===
'font'
)
{
expect
(
link
.
attribs
.
href
).
not
.
toContain
(
'dpl='
+
deploymentId
)
}
else
{
expect
(
link
.
attribs
.
href
).
toContain
(
'dpl='
+
deploymentId
)
expect
(
link
.
attribs
.
href
).
toContain
(
'dpl='
+
deploymentId
)
}
}
}
}
}
const
browser
=
await
next
.
browser
(
urlPath
)
const
browser
=
await
next
.
browser
(
urlPath
)
const
requests
=
[]
const
requests
=
[]
...
@@ -169,7 +173,11 @@ describe('deployment-id-handling disabled', () => {
...
@@ -169,7 +173,11 @@ describe('deployment-id-handling disabled', () => {
for
(
const
link
of
links
)
{
for
(
const
link
of
links
)
{
if
(
link
.
attribs
.
href
)
{
if
(
link
.
attribs
.
href
)
{
if
(
link
.
attribs
.
as
===
'font'
)
{
expect
(
link
.
attribs
.
href
).
not
.
toContain
(
'dpl='
+
deploymentId
)
expect
(
link
.
attribs
.
href
).
not
.
toContain
(
'dpl='
+
deploymentId
)
}
else
{
expect
(
link
.
attribs
.
href
).
not
.
toContain
(
'dpl='
+
deploymentId
)
}
}
}
}
}
...
...
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