Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

can't follow the output directory name set by nitro #17

Open
leosin opened this issue Nov 24, 2022 · 3 comments
Open

can't follow the output directory name set by nitro #17

leosin opened this issue Nov 24, 2022 · 3 comments

Comments

@leosin
Copy link

leosin commented Nov 24, 2022

for some reason, I changed the output directory to be named _output

with this option

nitro: {
    output: {
      dir: '~/_output',
    },
  },

but when i run build, the sitemap.xml still generated in default output dir .output/public

how can fix it ?

@Anoesj
Copy link

Anoesj commented Nov 25, 2022

Same issue as described in #13. If you happen to use pnpm, you can include this patch for now (in new root dir called patches):

diff --git a/dist/module.mjs b/dist/module.mjs
index 42d5b5120a05a0ee4038eaab31cf94c6c4a9a12f..d4a80714319f34b251bec82bfc1d472ca2ee4617 100644
--- a/dist/module.mjs
+++ b/dist/module.mjs
@@ -289,7 +289,7 @@ async function generateSitemaps(options, globalCache, nuxtInstance, depth = 0) {
   if (!nuxtInstance.options.generate?.dir) {
     nuxtInstance.options.generate.dir = nuxtInstance.options.srcDir;
   }
-  const publicDir = "/.output/public";
+  const publicDir = path.relative(nuxtInstance.options.generate.dir, nuxtInstance._nitro.options.output.publicDir);
   const isSitemapIndex = options && options.sitemaps && Array.isArray(options.sitemaps) && options.sitemaps.length > 0;
   if (isSitemapIndex) {
     await generateSitemapIndex(options, globalCache, nuxtInstance, depth, publicDir);

To enable, add to your package.json:

{
  "pnpm": {
    "patchedDependencies": {
      "@funken-studio/[email protected]": "patches/@[email protected]"
    }
  }
}

@leosin
Copy link
Author

leosin commented Nov 25, 2022

thank you , A bit complicated for me, but already great solution 😊

@ErwinAI
Copy link

ErwinAI commented Dec 18, 2022

Having the same problem, but with Vercel. The NITRO_PRESET is set to either vercel or vercel-edge. This causes the output dir to be .vercel/output/static in my case (ssr: false / static). See screenshot below for my build log.

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants