Search code examples
reactjsreact-snap

React-snap build fails unless build folder is uploaded to server


I'm using ReactJS and need some help with the build.

I am hosting a static site on a dedicated server.. in order to process that site I currently run my build locally and upload the 'build' folder to the server.

I've recently decided I should probably generate some static files for SEO (and adsense approval) and therefore I've added react-snap.

I run npm run build from my directory, and react-snap runs postbuild as expected however it fails unless I upload the build to the server first and then run the same build again to generate the static files (and then have to upload these again to the server for the static content to be available for search engine crawling).

I'm obviously missing a fundamental step in my build process here. I already want to refine it to a Git and push that to the server but I don't think this will help my react-snap problem.

Can anyone help?


Solution

  • Answering my own question for anyone with this problem...

    My production variable for homepage was set specifically to the domain.. this is not required and does not allow for local crawling of the site. Explanation here:

    https://github.com/stereobooster/react-snap/issues/153