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

feat(vercel): incremental static generation + swr #545

Merged
merged 12 commits into from
Nov 15, 2022
Merged

feat(vercel): incremental static generation + swr #545

merged 12 commits into from
Nov 15, 2022

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Oct 4, 2022

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Like #540, this PR adapts the vercel preset to automatically support ISG strategies based on the swr/static route rule.

For example, the following config would create prerender functions for the blog & articles routes. The blog routes would be generated only once and then persisted; the articles routes would be regenerated every 360 seconds.

export default defineNitroConfig({
  routes: {
    '/blog/**': { static: true },
    '/articles/**': { swr: 360 }
  }
})

Here's a deployment using this preset: https://verc-danielroe.vercel.app/

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe added the enhancement New feature or request label Oct 4, 2022
@danielroe danielroe requested a review from pi0 October 4, 2022 16:27
@danielroe danielroe self-assigned this Oct 4, 2022
@codecov
Copy link

codecov bot commented Oct 4, 2022

Codecov Report

Merging #545 (1f1224a) into main (0ccdc18) will increase coverage by 0.48%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #545      +/-   ##
==========================================
+ Coverage   66.43%   66.91%   +0.48%     
==========================================
  Files          57       57              
  Lines        4210     4232      +22     
  Branches      450      459       +9     
==========================================
+ Hits         2797     2832      +35     
+ Misses       1409     1397      -12     
+ Partials        4        3       -1     
Impacted Files Coverage Ξ”
src/presets/vercel.ts 74.12% <100.00%> (+9.66%) ⬆️
src/options.ts 87.36% <0.00%> (+2.60%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@bokub
Copy link

bokub commented Nov 8, 2022

Hello πŸ‘‹

Will this support a way to refresh a static page manually? For example with a bypassToken?

image

@danielroe
Copy link
Member Author

That is planned, but not part of this PR. (It's a straightforward enhancement, so it should be fairly quick to implement, and I already have a local proof-of-concept.)

@bokub
Copy link

bokub commented Nov 8, 2022

That's awesome, thanks a lot Daniel for your reactivity πŸ‘

@danielroe danielroe marked this pull request as ready for review November 9, 2022 10:25
@danielroe
Copy link
Member Author

We should be good to merge now - @TooTallNate fixed the upstream bug and also spotted an issue with a regexp. Sample deployment running with Vercel ISG: https://verc-danielroe.vercel.app.

cc: @pi0

src/runtime/entries/vercel.ts Outdated Show resolved Hide resolved
@bokub
Copy link

bokub commented Jan 10, 2023

Hi Daniel, sorry to bother you again on this question, but is there a way to refresh a static page manually (on-demand ISR) for a Nuxt project deployed on Vercel ?

I couldn't find anything in the current Nuxt documentation πŸ˜•

Thanks again !

@danielroe
Copy link
Member Author

This isn't yet implemented but will be 😊

@bokub
Copy link

bokub commented Jan 11, 2023

OK, thanks ! Is there some public road map or an issue I could follow to be alerted when this is implemented ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants