Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly list dynamic routes in error log #10443

Merged
merged 2 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shy-zoos-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-static': patch
---

fix: correctly list dynamic routes in error log
5 changes: 3 additions & 2 deletions packages/adapter-static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export default function (options) {

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

builder.log.error(
`@sveltejs/adapter-static: all routes must be fully prerenderable, but found the following routes that are dynamic:
${builder.routes.map((route) => ` - ${path.posix.join(prefix, route.id)}`).join('\n')}
${dynamic_routes.map((route) => ` - ${path.posix.join(prefix, route.id)}`).join('\n')}

You have the following options:
- set the \`fallback\` option — see https://kit.svelte.dev/docs/single-page-apps#usage for more info.
Expand Down