Check if js-compiled file exists before changing directory