preact-cli icon indicating copy to clipboard operation
preact-cli copied to clipboard

On Demand Pre-Render

Open Debdut opened this issue 5 years ago • 9 comments

Do you want to request a feature or report a bug?

Feature On Demand Pre-Render

What is the current behaviour? I can pre-render only while building using

preact build --prerenderUrls ./prerender.js

After the build is created, I am not able to pre-render without deleting previous build.

I am building an E-commerce site, when new products are added, I want to pre-render them and only those product pages, keeping rest of my previous build. Is it possible to create a system, when new pages are pre-rendered on demand?

Debdut avatar Oct 30 '20 14:10 Debdut

I don't want SSR for sure!

Debdut avatar Oct 30 '20 14:10 Debdut

This is a very interesting idea. @developit we should probably do this

prateekbh avatar Oct 30 '20 18:10 prateekbh

@Debdut curious about your use case, where and when would you like to trigger this additional prerendering?

  • Where? Would this be on the CI server or on the actual web server?
  • When? Would you trigger this when you add an item via some webhook or when the request comes?

prateekbh avatar Nov 23 '20 21:11 prateekbh

I trigger this when a request comes in

Debdut avatar Nov 23 '20 22:11 Debdut

If you create partial builds which can attach to previous build without deleting it, it works too

Debdut avatar Nov 23 '20 22:11 Debdut

I trigger this when a request comes in

So basically cached SSR?

ForsakenHarmony avatar Dec 07 '20 16:12 ForsakenHarmony

Yeah, thanks for the terminology

Debdut avatar Dec 07 '20 17:12 Debdut

I wonder what would the setup look like?

  • A request comes in, you check if the URL is already pre-rendered
  • You call a function in preact-cli
  • It generates the file for this and future requests
  • Future requests serve from previously prerendered file?

or

  • Introduce a server which does SSR for you and serve stale responses upto a given time

prateekbh avatar Dec 07 '20 19:12 prateekbh

First one sounds better

Debdut avatar Dec 07 '20 19:12 Debdut