Skip to content

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

Merged
pi0 merged 12 commits into
mainfrom
feat/vercel-isg
Nov 15, 2022
Merged

feat(vercel): incremental static generation + swr#545
pi0 merged 12 commits into
mainfrom
feat/vercel-isg

Conversation

@danielroe

@danielroedanielroe commented Oct 4, 2022

Copy link
Copy Markdown
Member

🔗 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.

exportdefaultdefineNitroConfig({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.

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

codecovBot commented Oct 4, 2022

Copy link
Copy Markdown

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 FilesCoverage Δ
src/presets/vercel.ts74.12% <100.00%> (+9.66%)⬆️
src/options.ts87.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

bokub commented Nov 8, 2022

Copy link
Copy Markdown

Hello 👋

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

image

@danielroe

Copy link
Copy Markdown
MemberAuthor

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

bokub commented Nov 8, 2022

Copy link
Copy Markdown

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
Copy Markdown
MemberAuthor

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

Comment threadsrc/runtime/entries/vercel.ts Outdated
@bokub

Copy link
Copy Markdown

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
Copy Markdown
MemberAuthor

This isn't yet implemented but will be 😊

@bokub

Copy link
Copy Markdown

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

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@danielroe@bokub@pi0