Skip to content

Commit

Permalink
fix(v2): Use writeFileSync to write generated sitemap.xml to avoid …
Browse files Browse the repository at this point in the history
…early termination
  • Loading branch information
SamChou19815 committed Apr 4, 2020
1 parent 3dd83be commit 83a5146
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/docusaurus-plugin-sitemap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ export default function pluginSitemap(

// Write sitemap file.
const sitemapPath = path.join(outDir, 'sitemap.xml');
fs.writeFile(sitemapPath, generatedSitemap, err => {
if (err) {
throw new Error(`Sitemap error: ${err}`);
}
});
try {
fs.writeFileSync(sitemapPath, generatedSitemap);
} catch (err) {
throw new Error(`Sitemap error: ${err}`);
}
},
};
}

0 comments on commit 83a5146

Please sign in to comment.