ProjectEvergreen / greenwood

Greenwood is your workbench for the web, embracing web standards from the ground up to empower your stack from front to back.
https://www.greenwoodjs.io
MIT License
96 stars 9 forks source link

`serve` command not serving prerendered SSR or static export content #1072

Closed thescientist13 closed 1 year ago

thescientist13 commented 1 year ago

Type of Change

Bug

Summary

After upgrade to v0.28.0-alpha.2, a project that was originally using prerender: true and an SSR route now shows a 404 page when serving the content.
https://github.com/AnalogStudiosRI/www.tuesdaystunes.tv/pull/110 Screen Shot 2023-02-20 at 9 38 07 AM

It should be noted the index.html IS correctly generated, just not being served as expected to the browser.

Details

Doing a little digging and I think what happened is now with the fix to #1059 in place, both static server and hybrid server are not running together anymore for just static content (a good thing!). However, now that no static server is running, this line basically precludes prerendered SSR content from being returned now.

if (isSPA || (matchingRoute && !matchingRoute.isSSR) || url.pathname.split('.').pop() === 'html') {
  ...
}

So basically need to make sure static and hybrid server are working together here:

  1. Make sure static server only handles static (or prerendered SSR) routes
  2. Let all non static routes get handled by hybrid server