In order to make the ESM builds work on modern browsers, without additional bundlers involved, would you consider change the way process.env.NODE_ENV is accessed to gracefully handle a missing process?
process?.env?.NODE_ENV or maybe process?.env.NODE_ENV should be enough.