kit
kit copied to clipboard
fix: don't error on dynamic routes with `prerender = false`
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 testand lint the project withpnpm lintandpnpm 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 changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.
Edits
- [x] Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.
🦋 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
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.
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: falseoption? 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.
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.