@auth0/cordova with Vite

Hi, has anyone managed to get @auth0/cordova working with Vite?

Currently I am stuck due to the crypto library. I have tried rollup-plugin-node-builtins, rollup-plugin-node-polyfills and rollup-plugin-polyfill-node to no avail as crypto did not contain the randomBytes function in all of these which is required by crypto.js.

The cordova-plugin-auth0 fork doesn’t work either.

I’ve tried various combinations of crypto-browserify and rollup-plugin-node-globals, to no avail.

OK I have kind of used a kludge, namely:

npm install --save-dev readable-stream@npm:vite-compatible-readable-stream
Replace crypto with crypto-browserify in @auth0/cordova/src/crypto.js
Replace stream with readable-stream in cipher-base/index.js

Obviously this is not a very good solution (although it works) so hopefully something can be done to patch @auth0/cordova to fix this.