Throw on build error if in production mode

Currently in production mode you'll get a undefined file with nothing in it if there's a build error. It'd be much better to just throw here.