Version 4 silently provided browser implementations of crypto, path and stream; 5 does not, and the first build after the upgrade does not compile.
// Module not found: Can't resolve 'crypto'
// BREAKING CHANGE: webpack < 5 used to include polyfills
// for node.js core modules by default.
// the answer is almost never this:
resolve: { fallback: { crypto: require.resolve('crypto-browserify') } }
// it is: find out why a BROWSER bundle wanted crypto.
// usually a library imported for one function that has a
// browser-native equivalent.
Adding the fallback works and ships several hundred kilobytes of polyfill to solve a problem that is usually an accidental import. Tracing it with webpack-bundle-analyzer takes ten minutes and frequently ends in deleting a dependency. The errors are all in node_modules, which makes the upgrade feel worse than it is — none of them are in code anybody wrote.