fix(sitemap): remove debug if sitemap disabled (#2514)

This commit is contained in:
Mark Pinero 2022-02-02 21:27:11 -08:00 committed by GitHub
parent ade996c885
commit 81238bf77d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -146,14 +146,14 @@ class AstroBuilder {
debug('build', timerMessage('Additional assets copied', timer.assetsStart));
// Build your final sitemap.
timer.sitemapStart = performance.now();
if (this.config.buildOptions.sitemap && this.config.buildOptions.site) {
timer.sitemapStart = performance.now();
const sitemap = generateSitemap(pageNames.map((pageName) => new URL(pageName, this.config.buildOptions.site).href));
const sitemapPath = new URL('./sitemap.xml', this.config.dist);
await fs.promises.mkdir(new URL('./', sitemapPath), { recursive: true });
await fs.promises.writeFile(sitemapPath, sitemap, 'utf8');
debug('build', timerMessage('Sitemap built', timer.sitemapStart));
}
debug('build', timerMessage('Sitemap built', timer.sitemapStart));
// You're done! Time to clean up.
await viteServer.close();