Skip to content

Commit

Permalink
fix turbopack cache clearing
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Sep 11, 2023
1 parent d38f3a2 commit 5e6442f
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions packages/next/src/server/lib/router-utils/setup-dev.ts
Expand Up @@ -311,21 +311,20 @@ async function startWatcher(opts: SetupOpts) {
async function processResult(
result: TurbopackResult<WrittenEndpoint>
): Promise<TurbopackResult<WrittenEndpoint>> {
await (global as any)._nextDeleteCache?.(
result.serverPaths
.map((p) => path.join(distDir, p))
.concat([
// We need to clear the chunk cache in react
require.resolve(
'next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js'
),
// And this redirecting module as well
require.resolve(
'next/dist/compiled/react-server-dom-webpack/client.edge.js'
),
])
)

for (const file of result.serverPaths
.map((p) => path.join(distDir, p))
.concat([
// We need to clear the chunk cache in react
require.resolve(
'next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js'
),
// And this redirecting module as well
require.resolve(
'next/dist/compiled/react-server-dom-webpack/client.edge.js'
),
])) {
deleteCache(file)
}
return result
}

Expand Down

0 comments on commit 5e6442f

Please sign in to comment.