using gsub to remove require tree, which javascript error in Chrome