Skip to content

Commit 926c22d

Browse files
authored
fix: correctly list dynamic routes in error log (#10443)
1 parent 7aa16ba commit 926c22d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/shy-zoos-sit.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-static': patch
3+
---
4+
5+
fix: correctly list dynamic routes in error log

packages/adapter-static/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export default function (options) {
88

99
async adapt(builder) {
1010
if (!options?.fallback) {
11-
if (builder.routes.some((route) => route.prerender !== true) && options?.strict !== false) {
11+
const dynamic_routes = builder.routes.filter((route) => route.prerender !== true);
12+
if (dynamic_routes.length > 0 && options?.strict !== false) {
1213
const prefix = path.relative('.', builder.config.kit.files.routes);
1314
const has_param_routes = builder.routes.some((route) => route.id.includes('['));
1415
const config_option =
@@ -22,7 +23,7 @@ export default function (options) {
2223

2324
builder.log.error(
2425
`@sveltejs/adapter-static: all routes must be fully prerenderable, but found the following routes that are dynamic:
25-
${builder.routes.map((route) => ` - ${path.posix.join(prefix, route.id)}`).join('\n')}
26+
${dynamic_routes.map((route) => ` - ${path.posix.join(prefix, route.id)}`).join('\n')}
2627
2728
You have the following options:
2829
- set the \`fallback\` option — see https://kit.svelte.dev/docs/single-page-apps#usage for more info.

0 commit comments

Comments
 (0)