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

perf(vite-node): only invalidate cache for user code #6156

Merged
merged 3 commits into from
Jul 26, 2022
Merged
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
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/')) {
pi0 marked this conversation as resolved.
Show resolved Hide resolved
runner.moduleCache.delete(key)
}
}
return result
}