ClojureScript Warnings as Errors
We recently ran into a problem at Nextjournal when we deployed a bad build to production. It turned out after renaming a var, we overlooked one instance. However, our CI didn't catch that.
Let's see how the ClojureScript compiler behaves with a source file using an undefined namespace.
Build it with the default compiler options.
As we see, it produces warnings, but the build is successful anyway. This is not desirable, we want the build to fail.
To make it fail, we have to build it with a custom warning handler to throw an error in addition to logging them, but clean the previous build first.
💥 Much better.
Also interesting: shadow-cljs has a dedicated compiler option for this.