Skip to content

Commit

Permalink
fix: join srcDir with filePath sent from hmr (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
northword authored May 12, 2024
1 parent ef0f995 commit ad9ded3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/vitepress-plugin-git-changelog/src/vite/git.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { cwd as _cwd } from 'node:process'
import type { Plugin, ResolvedConfig } from 'vite'
import { join } from 'node:path'
import { type Plugin, type ResolvedConfig, normalizePath } from 'vite'
import type { SiteConfig } from 'vitepress'
import ora from 'ora'
import { cyan, gray } from 'colorette'
Expand Down Expand Up @@ -158,7 +159,8 @@ export function GitChangelog(options: GitChangelogOptions = {}): Plugin {
commits = hotModuleReloadCachedCommits[data.page.filePath]
}
else {
commits = [...(await commitFromPath(data.page.filePath))]
const path = normalizePath(join(srcDir, data.page.filePath))
commits = [...(await commitFromPath(path))]
hotModuleReloadCachedCommits[data.page.filePath] = commits
}
if (!commits.length)
Expand Down

0 comments on commit ad9ded3

Please sign in to comment.