Skip to content

Commit

Permalink
fix: 🐛 fix distdir
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Reese committed Sep 18, 2020
1 parent 3d392bd commit c94449b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/sitemap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
}
Expand All @@ -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',
});
}
Expand Down

0 comments on commit c94449b

Please sign in to comment.