kit icon indicating copy to clipboard operation
kit copied to clipboard

fix: don't error on dynamic routes with `prerender = false`

Open teemingc opened this issue 1 year ago • 3 comments

fixes https://github.com/sveltejs/kit/issues/10332

Instead of always erroring on dynamic routes generated with the static adapter, we only error if the prerender option was not explicitly set. This allows users to have dynamic pages in the project but choose to ignore them, which is useful if they have multiple builds that may use a different adapter.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • [x] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • [x] This message body should clearly illustrate what problems it solves.
  • [ ] Ideally, include a test that fails without this PR but passes with it.

Tests

  • [x] Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • [x] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • [x] Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

teemingc avatar Oct 11 '24 01:10 teemingc

🦋 Changeset detected

Latest commit: 9520676a0f8b56f45cbe4bb94c658bd602f51bb4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/adapter-static Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Oct 11 '24 01:10 changeset-bot[bot]

Is this only about silencing that exact error? What is stopping people from setting the strict: false option? Is that undesireable for some reason? If we go with this solution the error that is otherwise thrown should probably also mention it.

dummdidumm avatar Oct 11 '24 12:10 dummdidumm

Is this only about silencing that exact error?

I think it's more about control of whether a route should error if it's not prerendered, which are only some routes but not all routes.

What is stopping people from setting the strict: false option? Is that undesireable for some reason?

I didn't know setting strict: false would disable those prerendering errors 😅 but I think that's undesirable here as it should still error on certain pages that should be prerendered, e.g., those affected by the root layout that sets prerender = true.

If we go with this solution the error that is otherwise thrown should probably also mention it.

I agree. I'll add the information to the error.

teemingc avatar Oct 14 '24 01:10 teemingc

Closing, because from what I understand the related issue wouldn't actually be fixed by this, and I'm still not sure we should do this in the first place.

dummdidumm avatar Jan 10 '25 17:01 dummdidumm