fix detection of filename in js optimizer running on chunk