Open dougnukem opened 3 years ago
I'm having a similar situation here.
For me I would like to generate /path/to/route.html
instead of /path/to/route/index.html
, so when hosting via heroku/heroku-buildpack-static it won't be automatically redirected to a route with a trailing slash.
Maybe there can be a separated option to specify extension for output files?
Yeah being able to configure the html output name makes sense. I also realized this solution does not make sense for nested paths, because a file can't also be a directory e.g.
/about
-> creates HTML file /about
/about/doug
-> creates HTML file /about/doug
FAILS to write this out because /about
is a file.I'll alter my PR to allow for configuring the output HTML file name.
I do think the only solution for hosting via S3 + AWS Cloudfront is to use Lambda@Edge scripts to rewrite the requests to serve index.html
for subdirectories, using these 2 scripts (would love to hear other simpler solutions that don't require extra Lambdas on every Cloudfront request)
This will help with my scenario: static s3 bucket behind cloudfront. I will try the natahouse fork until it's a vanilla feature
edlt: that helped, but I don't want the .html suffix at all. I will try renaming after react-snap has finished
Feature Request
Is your feature request related to a problem? Please describe. I want to use react-snap with S3 + CloudFront, but it's problematic to have to setup rules for serving
/ROUTE/index.html
routes when a user requests just/ROUTE
(from what I can tell it requires creating a Lambda@Edge script that runs on every request https://aws.amazon.com/blogs/compute/implementing-default-directory-indexes-in-amazon-s3-backed-amazon-cloudfront-origins-using-lambdaedge/)Describe the solution you'd like Ideally
react-snap
could just generate HTML output as the name of the route e.g./ROUTE
would just generate in output directorybuild/
build/ROUTE
as the HTML.Describe alternatives you've considered I could write a postbuild script that then converts the
ROUTE/index.html to just
ROUTE, but I'd rather there be a configuration option in
react-snap` to do that.Teachability, Documentation, Adoption, Migration Strategy If you can, explain how users will be able to use this and possibly write out a version the docs.
To output HTML to the route you want just configure
saveAsIndeHtml: false
inreact-snap
in yourpackage.json
config.