Skip to content

Commit

Permalink
prefix all route IDs with / - closes #7332
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Oct 21, 2022
1 parent 87b3037 commit abbb294
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 88 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-crabs-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[breaking] Prefix all route IDs with /
2 changes: 1 addition & 1 deletion packages/kit/src/core/prerender/prerender.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export async function prerender() {
for (const [id, prerender] of prerender_map) {
if (prerender) {
if (id.includes('[')) continue;
const path = `/${id.split('/').filter(affects_path).join('/')}`;
const path = `${id.split('/').filter(affects_path).join('/')}`;
enqueue(null, config.paths.base + path);
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/kit/src/core/sync/create_manifest_data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function create_routes_and_nodes(cwd, config, fallback) {
}
};

walk(0, '', '', null);
walk(0, '/', '', null);

if (routes.length === 1) {
const root = routes[0];
Expand All @@ -223,7 +223,7 @@ function create_routes_and_nodes(cwd, config, fallback) {
// If there's no routes directory, we'll just create a single empty route. This ensures the root layout and
// error components are included in the manifest, which is needed for subsequent build/dev commands to work
routes.push({
id: '',
id: '/',
segment: '',
pattern: /^$/,
names: [],
Expand Down
Loading

0 comments on commit abbb294

Please sign in to comment.