Skip to content

Commit d316ddc

Browse files
committed
Fix plugin error when no post
1 parent 147cfad commit d316ddc

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

plugins/vite-plugin-sitemap.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ interface SitemapPage {
1616
}
1717

1818
async function getPostsFromFileSystem(): Promise<Array<{ slug: string; frontmatter: any }>> {
19-
const postsDir = resolve(__dirname, 'src/posts')
20-
2119
try {
20+
const postsDir = resolve(__dirname, 'src/posts')
2221
const files = readdirSync(postsDir).filter(file => file.endsWith('.md'))
2322

2423
const posts = files.map(file => {

0 commit comments

Comments
 (0)