DEV Community

Discussion on: Deploying a static Gatsby app using Now.sh

Collapse
 
nwrichmond profile image
Nick Richmond

Can you explain what the purpose of the "builds" block is (in now.json)? Why are we setting src, use, and distDir the way you've outlined here?

Note that Zeit Now automatically inspects the package.json for a build command, so there isn't a need to explicitly set now-build. You can just use the regular "build": "gatsby build", which comes as a default command in package.json when using a Gatsby starter.

For other readers looking at the now.json and package.json in the Using CLI and Using GitHub sections and wondering how they are different in each section - I just checked with an online diff tool, and they are exactly the same...don't be like me, scrolling back and forth to try and find differences between them :)

Collapse
 
opshack profile image
Pooria A

There is a need, now.sh automatically looks for dist folder and Gatsby generates a public folder. So you either have to make gatsby build itself inside dist or ask now.sh to deploy the public folder.

For your second question, using a now-build script is recommended by the official docs: docs-git-plug-n-play-master.zeit.n...