Closed rubber-duck-software closed 1 year ago
This is a node module. process
always exists.
However, if it's not, your bundler might be broken.
isn't this package supposed to support browsers?
@DetachHead yes, it does - the way all node modules properly support browsers is by working with the original node module bundler, browserify, and any other non-broken node module bundler.
Broken node module bundlers aren't the concern of package authors.
i'm using vite, which doen't add process
by default and i think many other build tools behave the same. imo if a package is targeting browsers it shouldn't assume the bundler will always take care of missing node globals
That means vite is broken. Node packages that target browsers have always assumed that, and as such, that assumption is correct.
process is generally not defined in the browser environment. Before accessing properties on the process, we should verify process is defined