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: enhance and tighten up Vercel adapter warnings #9436

Merged
merged 2 commits into from
Mar 17, 2023

Conversation

dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented Mar 17, 2023

  • warn when prerender setting makes isr config useless
  • don't show cron warning when everything's valid
  • allow to set isr to false to clear isr config in leafs (else it's impossible to do so because config is merged at the top level)
  • prefixed all warnings with "Warning:" which should help detect the Vercel log dashboard show these in condensed mode where only warnings/errors are shown
  • prerender = 'auto' routes are now also excempt from further processing if we can determine that this is equal to prerender = true (because there are no dynamic routes)

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

  • 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
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • 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:.

- warn when prerender setting makes isr config useless
- don't show cron warning when everything's valid
- allow to set isr to false to clear isr config in leafs (else it's impossible to do so because config is merged at the top level)
- prefixed all warnings with "Warning:" which should help detect the Vercel log dashboard show these in condensed mode where only warnings/errors are shown
@changeset-bot
Copy link

changeset-bot bot commented Mar 17, 2023

🦋 Changeset detected

Latest commit: afb36db

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-vercel Minor

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

@@ -87,7 +87,7 @@ export interface Builder {
config: ValidatedConfig;
/** Information about prerendered pages and assets, if any. */
prerendered: Prerendered;
/** An array of dynamic (not prerendered) routes */
/** An array of all routes (including prerendered) */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by comment fix - I don't think we need a changeset for this, it's okay to just release it as part of the next Kit release without special mention

@@ -219,6 +226,20 @@ const plugin = function (defaults = {}) {
group.routes.push(route);
}

if (ignored_isr.size) {
builder.log.warn(
`\nWarning: The following routes have an ISR config which is ignored because the route is prerendered:`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this a warning, thought about whether or not this is an error, but I think that would be breaking - maybe in the next major? Or would this be more annoying than helpful if it was an error?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a warning is probably fine, you could have a prerendered leaf within an ISR'd group, for example. we can see if people trip up on it in practice

Copy link
Member

@Rich-Harris Rich-Harris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made one small suggestion but otherwise LGTM

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants