Skip to content

Commit

Permalink
[fix] strip paths.base before resolving assets in preview server. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Karlinator committed Sep 22, 2021
1 parent d9372d9 commit fb2e134
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-monkeys-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

Fix preview when `kit.paths.base` is set.
3 changes: 3 additions & 0 deletions packages/kit/src/core/preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ export async function preview({
render_handler();
}
} else {
if (initial_url.startsWith(config.kit.paths.base)) {
req.url = initial_url.slice(config.kit.paths.base.length);
}
assets_handler(req, res, () => {
static_handler(req, res, render_handler);
});
Expand Down

0 comments on commit fb2e134

Please sign in to comment.