sourcemap filename is optional so put a guard around the path replace