From 5eba5f24a2b48e199e5457e4899547d5cbd9f6b4 Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Sun, 5 Apr 2020 18:09:28 +0300 Subject: [PATCH] fix(v2): use synchronous write for generate blog feeds (#2540) * fix(v2): use synchronous write for generate blog feeds * FIx code style --- packages/docusaurus-plugin-content-blog/src/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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}`); + } }), ); },