diff --git a/packages/docusaurus-plugin-content-blog/src/index.ts b/packages/docusaurus-plugin-content-blog/src/index.ts index 15405200d388..1868e9698a36 100644 --- a/packages/docusaurus-plugin-content-blog/src/index.ts +++ b/packages/docusaurus-plugin-content-blog/src/index.ts @@ -429,11 +429,11 @@ export default function pluginContentBlog( `${feedType}.xml`, ); const feedContent = feedType === 'rss' ? feed.rss2() : feed.atom1(); - return fs.writeFile(feedPath, feedContent, (err) => { - if (err) { - throw new Error(`Generating ${feedType} feed failed: ${err}`); - } - }); + try { + fs.writeFileSync(feedPath, feedContent); + } catch (err) { + throw new Error(`Generating ${feedType} feed failed: ${err}`); + } }), ); },