Skip to content

Commit

Permalink
fix(v2): use synchronous write for generate blog feeds (#2540)
Browse files Browse the repository at this point in the history
* fix(v2): use synchronous write for generate blog feeds

* FIx code style
  • Loading branch information
lex111 authored Apr 5, 2020
1 parent 1f00d15 commit 5eba5f2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/docusaurus-plugin-content-blog/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
}),
);
},
Expand Down

0 comments on commit 5eba5f2

Please sign in to comment.