Speed up build time when there are no yaml files

js-yaml module takes a while to load. Moving it inside condition can speed up loading of readfile.js by ~7000 times.