From c94449b27e4ea28ae79b52ac03638434855d0495 Mon Sep 17 00:00:00 2001 From: Nick Reese Date: Fri, 18 Sep 2020 15:03:28 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20fix=20distdir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/sitemap/index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/sitemap/index.js b/packages/sitemap/index.js index 0047dad..272eb3a 100644 --- a/packages/sitemap/index.js +++ b/packages/sitemap/index.js @@ -138,12 +138,12 @@ const plugin = { xml += SITEMAP_FOOTER; // todo: remove after v1. - if (settings.locations && settings.locations.public) { - fs.writeFileSync(path.resolve(process.cwd(), settings.locations.public, `./${indexFileName}`), xml, { + if (settings.distDir) { + fs.writeFileSync(path.resolve(settings.distDir, `./${indexFileName}`), xml, { encoding: 'utf-8', }); - } else if (settings.distDir) { - fs.writeFileSync(path.resolve(settings.distDir, `./${indexFileName}`), xml, { + } else if (settings.locations && settings.locations.public) { + fs.writeFileSync(path.resolve(process.cwd(), settings.locations.public, `./${indexFileName}`), xml, { encoding: 'utf-8', }); } @@ -157,12 +157,12 @@ const plugin = { indexXml += SITEMAP_INDEX_FOOTER; // todo: remove after v1. - if (settings.locations && settings.locations.public) { - fs.writeFileSync(path.resolve(process.cwd(), settings.locations.public, './sitemap.xml'), indexXml, { + if (settings.distDir) { + fs.writeFileSync(path.resolve(settings.distDir, './sitemap.xml'), indexXml, { encoding: 'utf-8', }); - } else if (settings.distDir) { - fs.writeFileSync(path.resolve(settings.distDir, './sitemap.xml'), indexXml, { + } else if (settings.locations && settings.locations.public) { + fs.writeFileSync(path.resolve(process.cwd(), settings.locations.public, './sitemap.xml'), indexXml, { encoding: 'utf-8', }); }