It appears to be a duplicate of this error related to 'TypeError: Cannot read properties of undefined (reading 'call') on build but not in dev mode, but I am still unable to identify the cause.
I am using Vue/Vite.js app with web3auth installed. The application works as expected when running in dev mode, but encounters an error when run in production mode (build) displaying:
"TypeError: Cannot read properties of undefined (reading 'call')"
and 'error while initializing adapter'
.
The issue arises at the line await web3auth.initModal();
The error output is as follows:
web3auth.esm.js:310 TypeError: Cannot read properties of undefined (reading 'call')
at new e0 (_stream_duplex.js:60:12)
at new zN (openloginJrpc.esm.js:26:5)
at new Que (openloginJrpc.esm.js:966:1)
at DNe.setupStream (openlogin.esm.js:285:31)
at DNe.init (openlogin.esm.js:280:10)
... more detailed error logs here ...
Vite.config.js
import { fileURLToPath, URL } from "url";
// Other imports and configurations...
export default defineConfig({
plugins: [
// Plugin configurations...
],
resolve: {
alias: {
// Alias mappings...
},
},
css: {
preprocessorOptions: {
sass: {
additionalData: `@import "./src/assets/base.scss";`,
},
},
},
optimizeDeps: {
esbuildOptions: {
// ESBuild options...
}
},
build: {
sourcemap: true,
rollupOptions: {
plugins: [
// Rollup plugin configurations...
]
},
}
});