3

I have an app that works in the following way:

  • Client bundles are built with webpack and output to /client/app/public/build.
  • An express server runs from /server/index.js and renders a handlebars template using some environment variables.

After I run yarn run build and the postbuild script is executed, it fails immediately with the following error:

yarn run v1.9.4
$ react-snap
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open '/Users/aington/git/static-help/build/index.html'
error Command failed with exit code 1.

This makes sense, since there are no files in that location.

I know that react-snap prides itself on being a zero-configuration library, but I really would like to configure it so that it can point to the right directory for serving files. Additionally, the Express server provides an authentication library, so that needs to run too.

Is it realistic to expect that react-snap can do this and still crawl and pre-render the site? Or should I explore other options?

Aaron Cunnington
  • 1,631
  • 2
  • 15
  • 23

1 Answers1

4

Check the default options in index.js

https://github.com/stereobooster/react-snap/blob/97542b802917362773a2601f52d368c01bd5e0f7/index.js#L15

and use it in package.json like the below

"reactSnap" : {
   "source" : "./dist"

}
sgwanlee
  • 41
  • 1
  • 3