Skip to content

Commit

Permalink
[fix] prerendering not working with kit.paths.base set. (#2407)
Browse files Browse the repository at this point in the history
  • Loading branch information
Karlinator committed Sep 20, 2021
1 parent bc9ece1 commit 6bd21c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-dodos-greet.md
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

Fix prerendering/adapter-static failing when `kit.paths.base` was set.
6 changes: 3 additions & 3 deletions packages/kit/src/core/adapt/prerender.js
Expand Up @@ -260,16 +260,16 @@ export async function prerender({ cwd, out, log, config, build_data, fallback, a
if (!resolved.startsWith('/') || resolved.startsWith('//')) continue;

const parsed = new URL(resolved, 'http://localhost');
const pathname = decodeURI(parsed.pathname);
const pathname = decodeURI(parsed.pathname).replace(config.kit.paths.base, '');

const file = pathname.replace(config.kit.paths.assets, '').slice(1);
const file = pathname.slice(1);
if (files.has(file)) continue;

if (parsed.search) {
// TODO warn that query strings have no effect on statically-exported pages
}

await visit(pathname.replace(config.kit.paths.base, ''), path);
await visit(pathname, path);
}
}
}
Expand Down

0 comments on commit 6bd21c7

Please sign in to comment.