fix(vite): update render if it is invalidated (#7347)

This commit is contained in:
Daniel Roe 2022-09-08 15:17:22 +01:00 committed by GitHub
parent 4660cc5918
commit e22bbcc380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,7 @@ export default async (ssrContext) => {
// Execute SSR bundle on demand
const start = performance.now()
render = render || (await runner.executeFile(viteNodeOptions.entryPath)).default
render = (updates.has(viteNodeOptions.entryPath) || !render) ? (await runner.executeFile(viteNodeOptions.entryPath)).default : render
if (updates.size) {
const time = Math.round((performance.now() - start) * 1000) / 1000
consola.success(`Vite server hmr ${updates.size} files`, time ? `in ${time}ms` : '')