stereobooster / react-snap

👻 Zero-configuration framework-agnostic static prerendering for SPAs
MIT License
5.04k stars 391 forks source link

Add saveAsIndexHtml default(true) to allow saving routes as raw paths vs ROUTE/index.html #494

Closed dougnukem closed 3 years ago

dougnukem commented 3 years ago

Description

closes #493

Allows HTML output to be configured to output to /ROUTE instead of /ROUTE/index.html

By default via:

saveAsIndexHtml: true

To have it output to /ROUTE:

saveAsIndexHtml: false
andyrichardson commented 3 years ago

@stereobooster how do you feel about this being merged in?

dougnukem commented 3 years ago

The danger with this it doesn't allow using nested URL paths e.g. you can't have a:

https://example.com/products

and

https://example.com/products/abc-123

because you'd need a subfolder for /products/abc-123

I think it can work for some specific cases but it might be better to solve via your HTTP server / CDN / Cloudfront

For example if you host on Cloudfront you can use lambda@edge functions to server default index.html per subdirectory backed by S3: https://medium.com/@chrispointon/default-files-in-s3-subdirectories-using-cloudfront-and-lambda-edge-941100a3c629

see: https://github.com/stereobooster/react-snap/issues/493#issuecomment-685756623