@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.

@customautosys Did you ever find any better solution? I’m running into this same issue. I haven’t been able to get your kludge to work either because I run into some issue referencing “process” which I haven’t found a resolution for yet. Thanks

Same problem here… auth0, please, fix this problem!

1 Like

Same problem here… We use quasar framework with vite/webpack and got this same issue. How can we solve this?