dont run hmr hooks on ssr env

pull/4525/head
Divyansh Singh 7 months ago
parent 718a1610de
commit d35e7c7338

@ -424,6 +424,8 @@ export async function createVitePressPlugin(
const hmrFix: Plugin = { const hmrFix: Plugin = {
name: 'vitepress:hmr-fix', name: 'vitepress:hmr-fix',
async hotUpdate({ file, modules }) { async hotUpdate({ file, modules }) {
if (this.environment.name !== 'client') return
const importers = [...(importerMap[slash(file)] || [])] const importers = [...(importerMap[slash(file)] || [])]
if (importers.length > 0) { if (importers.length > 0) {
return [ return [

@ -141,6 +141,8 @@ export const dynamicRoutesPlugin = async (
}, },
async hotUpdate({ file, modules: existingMods }) { async hotUpdate({ file, modules: existingMods }) {
if (this.environment.name !== 'client') return
routeModuleCache.delete(file) routeModuleCache.delete(file)
const modules: EnvironmentModuleNode[] = [] const modules: EnvironmentModuleNode[] = []

@ -199,6 +199,8 @@ export async function localSearchPlugin(
}, },
async hotUpdate({ file }) { async hotUpdate({ file }) {
if (this.environment.name !== 'client') return
if (file.endsWith('.md')) { if (file.endsWith('.md')) {
await indexFile(file) await indexFile(file)
debug('🔍️ Updated', file) debug('🔍️ Updated', file)

@ -124,6 +124,8 @@ export const staticDataPlugin: Plugin = {
}, },
hotUpdate({ file, modules: existingMods }) { hotUpdate({ file, modules: existingMods }) {
if (this.environment.name !== 'client') return
const modules: EnvironmentModuleNode[] = [] const modules: EnvironmentModuleNode[] = []
// dependency of data loader changed // dependency of data loader changed

Loading…
Cancel
Save