pull/4525/head
Divyansh Singh 7 months ago
parent 08fab8aca5
commit e780afb977

@ -423,7 +423,7 @@ export async function createVitePressPlugin(
const hmrFix: Plugin = { const hmrFix: Plugin = {
name: 'vitepress:hmr-fix', name: 'vitepress:hmr-fix',
async hotUpdate({ file, server, modules }) { async hotUpdate({ file, modules }) {
const importers = [...(importerMap[slash(file)] || [])] const importers = [...(importerMap[slash(file)] || [])]
if (importers.length > 0) { if (importers.length > 0) {
return [ return [

@ -140,8 +140,7 @@ export const dynamicRoutesPlugin = async (
} }
}, },
async hotUpdate(ctx) { async hotUpdate({ file, modules: existingMods }) {
const file = ctx.file
const modules: EnvironmentModuleNode[] = [] const modules: EnvironmentModuleNode[] = []
const mods = config.dynamicRoutes.fileToModulesMap[file] const mods = config.dynamicRoutes.fileToModulesMap[file]
@ -158,7 +157,7 @@ export const dynamicRoutesPlugin = async (
} }
} }
return modules.length > 0 ? [...ctx.modules, ...modules] : undefined return modules.length > 0 ? [...existingMods, ...modules] : undefined
} }
} }
} }

@ -123,8 +123,7 @@ export const staticDataPlugin: Plugin = {
} }
}, },
hotUpdate(ctx) { hotUpdate({ file, modules: existingMods }) {
const file = ctx.file
const modules: EnvironmentModuleNode[] = [] const modules: EnvironmentModuleNode[] = []
// dependency of data loader changed // dependency of data loader changed
@ -142,6 +141,6 @@ export const staticDataPlugin: Plugin = {
} }
} }
return modules.length > 0 ? [...ctx.modules, ...modules] : undefined return modules.length > 0 ? [...existingMods, ...modules] : undefined
} }
} }

Loading…
Cancel
Save