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
ea2157cd
Unverified
Commit
ea2157cd
authored
Jul 16, 2025
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Jul 16, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[turbopack] Clear chunk cache on HMR instead of creating new `next-server` VM (#81664)
parent
43b64ccd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
20 deletions
+2
-20
hot-reloader-turbopack.ts
packages/next/src/server/dev/hot-reloader-turbopack.ts
+1
-19
require-cache.ts
packages/next/src/server/dev/require-cache.ts
+1
-1
No files found.
packages/next/src/server/dev/hot-reloader-turbopack.ts
View file @
ea2157cd
...
...
@@ -37,7 +37,7 @@ import {
}
from
'./middleware-turbopack'
import
{
PageNotFoundError
}
from
'../../shared/lib/utils'
import
{
debounce
}
from
'../utils'
import
{
deleteCache
,
deleteFromRequireCache
}
from
'./require-cache'
import
{
deleteCache
}
from
'./require-cache'
import
{
clearAllModuleContexts
,
clearModuleContext
,
...
...
@@ -342,30 +342,12 @@ export async function createHotReloaderTurbopack(
resetFetch
()
const
hasAppPaths
=
writtenEndpoint
.
serverPaths
.
some
(({
path
:
p
})
=>
p
.
startsWith
(
'server/app'
)
)
// Edge uses the browser runtime which already disposes chunks individually.
// TODO: process.env.NEXT_RUNTIME is 'nodejs' even though Node.js runtime is not used.
if
(
'__turbopack_clear_chunk_cache__'
in
globalThis
)
{
;(
globalThis
as
any
).
__turbopack_clear_chunk_cache__
()
}
// TODO: Stop re-evaluating React Client once it relies on Turbopack's chunk cache.
if
(
hasAppPaths
)
{
deleteFromRequireCache
(
require
.
resolve
(
'next/dist/compiled/next-server/app-page-turbo.runtime.dev.js'
)
)
deleteFromRequireCache
(
require
.
resolve
(
'next/dist/compiled/next-server/app-page-turbo-experimental.runtime.dev.js'
)
)
}
const
serverPaths
=
writtenEndpoint
.
serverPaths
.
map
(({
path
:
p
})
=>
join
(
distDir
,
p
)
)
...
...
packages/next/src/server/dev/require-cache.ts
View file @
ea2157cd
...
...
@@ -2,7 +2,7 @@ import isError from '../../lib/is-error'
import
{
realpathSync
}
from
'../../lib/realpath'
import
{
clearManifestCache
}
from
'../load-manifest.external'
export
function
deleteFromRequireCache
(
filePath
:
string
)
{
function
deleteFromRequireCache
(
filePath
:
string
)
{
try
{
filePath
=
realpathSync
(
filePath
)
}
catch
(
e
)
{
...
...
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