Uncaught TypeError: Cannot read property 'from' of undefined

I am creating client side app using vitejs bundler and this is the error I am getting:
dgraph-js-http: ^21.3.1

Note: I tried this react to-do app example using vitejs.

I suppose in this case vitejs can’t resolve commonjs modules correctly. So there is unknown Buffer in this case.

This is the problem, although does no work in browser space.