diff --git a/src/node/plugin.ts b/src/node/plugin.ts index 078fd2a6..64eea2a3 100644 --- a/src/node/plugin.ts +++ b/src/node/plugin.ts @@ -3,7 +3,6 @@ import c from 'picocolors' import { mergeConfig, searchForWorkspaceRoot, - type ModuleNode, type Plugin, type ResolvedConfig, type Rollup, @@ -424,16 +423,16 @@ export async function createVitePressPlugin( const hmrFix: Plugin = { name: 'vitepress:hmr-fix', - async handleHotUpdate({ file, server, modules }) { + async hotUpdate({ file, server, modules }) { const importers = [...(importerMap[slash(file)] || [])] if (importers.length > 0) { return [ ...modules, ...importers.map((id) => { clearCache(slash(path.relative(srcDir, id))) - return server.moduleGraph.getModuleById(id) + return this.environment.moduleGraph.getModuleById(id) }) - ].filter(Boolean) as ModuleNode[] + ].filter((mod) => mod !== undefined) } } } diff --git a/src/node/plugins/dynamicRoutesPlugin.ts b/src/node/plugins/dynamicRoutesPlugin.ts index 324a4a4f..15fecb60 100644 --- a/src/node/plugins/dynamicRoutesPlugin.ts +++ b/src/node/plugins/dynamicRoutesPlugin.ts @@ -3,9 +3,9 @@ import path from 'node:path' import c from 'picocolors' import { glob } from 'tinyglobby' import { - EnvironmentModuleNode, loadConfigFromFile, normalizePath, + type EnvironmentModuleNode, type Logger, type Plugin } from 'vite' diff --git a/src/node/plugins/localSearchPlugin.ts b/src/node/plugins/localSearchPlugin.ts index bffe74e8..d36b2526 100644 --- a/src/node/plugins/localSearchPlugin.ts +++ b/src/node/plugins/localSearchPlugin.ts @@ -198,7 +198,7 @@ export async function localSearchPlugin( } }, - async handleHotUpdate({ file }) { + async hotUpdate({ file }) { if (file.endsWith('.md')) { await indexFile(file) debug('🔍️ Updated', file)