diff --git a/src/server.ts b/src/server.ts index 07da16c5..d68c3bf8 100644 --- a/src/server.ts +++ b/src/server.ts @@ -101,15 +101,29 @@ function createVitePressPlugin(config: SiteConfig): Plugin { if (ctx.path.endsWith('.md')) { const file = resolver.requestToFile(ctx.path) await cachedRead(ctx, file) + // let vite know this is supposed to be treated as vue file ctx.vue = true - ctx.body = markdownToVue( + + const { vueSrc, pageData } = markdownToVue( ctx.body, file, - ctx.lastModified.getTime() - ).vueSrc + ctx.lastModified.getTime(), + false + ) + ctx.body = vueSrc debug(ctx.url, ctx.status) - return next() + + await next() + + // make sure this is the main