Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
perf(vite-node): only invalidate cache for user code (#6156)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 26, 2022
1 parent 54da45e commit f0485d8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/vite/src/runtime/vite-node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export default async (ssrContext) => {
process.server = true
render = render || (await runner.executeFile(viteNodeOptions.entryPath)).default
const result = await render(ssrContext)
runner.moduleCache.clear()
// reset cache for non-node-modules
for (const key of runner.moduleCache.keys()) {
if (!key.includes('/node_modules/')) {
runner.moduleCache.delete(key)
}
}
return result
}

0 comments on commit f0485d8

Please sign in to comment.