We are proud to announce a significant improvement to our developer experience: validation on output paths for static builds. As of today, @now/static-build validates a given distDir configuration option, aborting a build if the output directory doesn't exist.
This seemingly simple validation step is incredibly important for multiple reasons. Read on as we detail the steps that led to this release.

Configuration Validation in Now

Rule #1 of Human-Computer Interaction (HCI) is to ensure that the user is always aware of the state of the system. As such, validation becomes increasingly important. Now validates a user's now.json before anything else – syncing, uploading, or deploying – because incorrect data from the beginning leads to unfavorable results in the end.

Static Builds

@now/static-build builds content in the cloud and serves the static built output. It typically assumes that the final built artifacts exist in a dist directory, but in some cases, build tools have different outputs: public or static, for example.
Upon examining multiple reports of 404 Page Not Found errors on apps deployed on Now, we were able to identify that the source of confusion around these errors was that the output directory specified by a user in now.json simply did not exist.
What was happening was that the builder would run to completion and then exit successfully, serving the contents of a non-existent directory. This would result in a 404 when accessed. While this is expected behavior in the builder and not technically a bug, it can lead to outcomes that users do not expect in the event of an invalid distDir configuration option.
GitHub Integration
One particular case of this involves websites and applications deployed using our GitHub integration. Previously, a merge to master would automatically deploy a website using @now/static-build and immediately alias it to a user's chosen aliases. This could sometimes lead to a surprising 404 on production in the event that the output directory was incorrectly configured.
With today's upgrade to @now/static-build, this is no longer the case. The integration will abort, the check will fail, and the deployment will not occur. Your websites and applications stay up.


Developer experience is of the highest priority at ZEIT. We proudly aim to serve our developer community as best we can. It is our hope that the changes to @now/static-build do exactly this, and that our developers continue developing with the ease that they know and love from our tools. As always, we are open to your feedback, questions, concerns and praise. Feel free to reach out on Twitter.