Webpack 5 no longer provides polyfills for NodeJS packages. In my case I get Uncaught ReferenceError: process is not defined from this line. I.e., it's process.platform that fails.
I'm running an app built with Create React App, which is why I think the previous line referencing process.env seems to work.