From 1463ed1718a91a00d18c315f0c4073270bce5035 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}`); + } }), ); },