Update buildJavaScript.js to use the UglifyJS2 API

The one being used refers to the old UglifyJS API, which is deprecated and does not match the one obtained from "npm install uglify-js".