Hi all,
I am adding the Web3Auth sign in modal to our existing Vue app that is built with Vite.
I have it mostly working in the development environment. It can load the module and I can sign in with social and solana wallets.
But when I compile the build for production and run that, it spins and does not load.
Development
:
Production
:
Our code is pretty standard I think. I followed the example Vue code here.
There were some things I had to work around, like it was asking for NodeJS methods like require
, process
and Buffer
. I am not sure if that is having an effect in the production build. I have not changed much else except that this is running in a Vite build that I think is using Rollup under the hood for bundling.
For those I did some polyfill from the main index.html
:
window.Buffer = Buffer;
window.process = process;
</script>">
<script>window.global = window;</script>
<script type=“module”>
import process from “process”;
import { Buffer } from “buffer”;window.Buffer = Buffer;
window.process = process;
</script>
and in the vite.config.js
:
build: {
target: 'es2020',
commonjsOptions: {
transformMixedEsModules: true
}
},
Also, currently our build is client side only. I was thinking of converting the build to be server side rendered. I don't know if that would solve it.
If anyone has any ideas or has run in to a similar, any suggestion or feedback how can debug is appreciated.
Thank you
Originally posted by: mwilc0x
Check the discussion at: https://github.com/orgs/Web3Auth/discussions/729