use cachedRead

pull/1/head
Evan You 4 years ago
parent 24bac77eec
commit 3196f90a56

@ -1,5 +1,4 @@
import path from 'path'
import { promises as fs } from 'fs'
import {
createServer as createViteServer,
cachedRead,
@ -44,7 +43,7 @@ const VitePressPlugin: Plugin = ({ app, root, watcher, resolver }) => {
// hot reload .md files as .vue files
watcher.on('change', async (file) => {
if (file.endsWith('.md')) {
const content = await fs.readFile(file, 'utf-8')
const content = await cachedRead(null, file)
watcher.handleVueReload(file, Date.now(), markdownToVue(content))
}
})

Loading…
Cancel
Save