Skip to content

fix(vercel, azure): serve prerendered routes statically - #500

Merged
pi0 merged 11 commits into
mainfrom
fix/vercel-static
Sep 14, 2022
Merged

fix(vercel, azure): serve prerendered routes statically#500
pi0 merged 11 commits into
mainfrom
fix/vercel-static

Conversation

@danielroe

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

Current hybrid vercel deployments will always server-render prerendered HTML (though you can get the static html by adding /index.html to the URL). Vercel provides the overrides property to allow us to map clean URLs (without .html or index.html suffix) to static files: https://vercel.com/docs/build-output-api/v3#build-output-configuration/supported-properties/overrides. This PR implements that.

Might also be worth a consistent implementation of accessing which HTML files have been prerendered. (See this line for how we were doing it in Azure - I could easily create a shared context that both presets could use - happy to pick this up.)

📝 Checklist

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

@danielroe danielroe added the bug Something isn't working label Sep 14, 2022
@danielroe
danielroe requested a review from pi0 September 14, 2022 11:53
@danielroe danielroe self-assigned this Sep 14, 2022
@codecov

codecov Bot commented Sep 14, 2022

Copy link
Copy Markdown

Codecov Report

Merging #500 (a460eea) into main (2dd05fb) will decrease coverage by 0.14%.
The diff coverage is 54.83%.

@@            Coverage Diff             @@
##             main     #500      +/-   ##
==========================================
- Coverage   63.62%   63.48%   -0.15%     
==========================================
  Files          55       55              
  Lines        3634     3620      -14     
  Branches      394      392       -2     
==========================================
- Hits         2312     2298      -14     
+ Misses       1309     1308       -1     
- Partials       13       14       +1     
Impacted Files Coverage Δ
src/types/nitro.ts 100.00% <ø> (ø)
src/presets/azure.ts 13.67% <13.04%> (-0.04%) ⬇️
src/presets/vercel.ts 65.04% <78.37%> (-8.17%) ⬇️
src/prerender.ts 86.74% <100.00%> (+0.16%) ⬆️

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

Comment thread src/presets/vercel.ts Outdated
Comment thread src/presets/vercel.ts Outdated
@pi0 pi0 changed the title fix(vercel): serve prerendered routes statically fix(vercel, azure): serve prerendered routes statically Sep 14, 2022
@pi0
pi0 merged commit 1b78f28 into main Sep 14, 2022
@pi0
pi0 deleted the fix/vercel-static branch September 14, 2022 14:35
WinterYukky pushed a commit to WinterYukky/nitro that referenced this pull request Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants