I had the same issue, this is the working solution i found on git hub.
https://github.com/ChainSafe/web3.js/issues/4070
run in your project directory:
npm install crypto-browserify stream-browserify assert stream-http https-browserify os-browserify
tsconfig.json
Add this in:”compilerOptions”: { […] }
"paths" : {
"crypto": ["./node_modules/crypto-browserify"],
"stream": ["./node_modules/stream-browserify"],
"assert": ["./node_modules/assert"],
"http": ["./node_modules/stream-http"],
"https": ["./node_modules/https-browserify"],
"os": ["./node_modules/os-browserify"],
}