Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions packages/next/src/server/dev/hot-reloader-turbopack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
)
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/dev/require-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading