Browserify is designed to interface with a Node-like or Browser-like ecosystem, particularly when it comes to global variables and ambient variables like
Error. ExtendScript does not provide these variables in an object like
window, but magically makes them ambient. This plugin adjusts Browserify's globals to take advantage of this.
npm i browserify-extendscript
If you use Browserify on the command line:
browserify -p browserify-extendscript [...]
If you use Browserify in code:
var bundler = browserify(); // as before bundler.plugin('browserify-extendscript'); bundler.bundle(); // as before