Hello Web3Auth Community,
I’m encountering issues when run build a Web3Auth-integrated Quasar app. While the build completes successfully, the app throws errors in the browser once deployed.
Details:
- SDK Version:
"@web3auth/base": "^9.2.3", "@web3auth/ethereum-provider": "^9.2.3", "@web3auth/modal": "^9.2.3", "@web3auth/wallet-services-plugin": "^9.2.4"
- Platform:
- Frontend: Vue 3, Quasar Framework (using Vite)
quasar… v2.16.8
@quasar/app-vite… v1.9.4
vite… v2.9.18 - Deployment: Vercel
- Frontend: Vue 3, Quasar Framework (using Vite)
The Issue:
'hexToBuffer' is not exported by node_modules/enc-utils/dist/cjs/index.js, imported by node_modules/@toruslabs/starkware-crypto/dist/lib.esm/key_derivation.js
1: import { mnemonicToSeedSync } from 'bip39';
2: import BN from 'bn.js';
3: import { hexToBuffer, removeHexPrefix, sanitizeBytes, numberToHex, hexToBinary, binaryToNumber } from 'enc-utils';
^
4: import { HDKey } from 'ethereum-cryptography/hdkey';
5: import hash from 'hash.js';
Error: 'hexToBuffer' is not exported by node_modules/enc-utils/dist/cjs/index.js, imported by node_modules/@toruslabs/starkware-crypto/dist/lib.esm/key_derivation.js
Vite Configuration in Quasar:
extendViteConf(cfg) {
cfg.plugins = cfg.plugins || [];
cfg.plugins.push(
resolve({
browser: true,
preferBuiltins: false,
})
);
cfg.plugins.push(
inject({
Buffer: ["buffer", "Buffer"],
})
);
},
polyfill.js boot file:
import { Buffer } from "buffer";
import inherits from "inherits";
import "core-js/actual";
if (typeof globalThis !== "undefined" && !globalThis.inherits) {
globalThis.inherits = inherits;
}
if (typeof globalThis !== "undefined" && !globalThis?.Buffer) {
globalThis.Buffer = Buffer;
}
if (typeof window !== "undefined" && !window?.Buffer) {
window.Buffer = Buffer;
}
Questions:
- Has anyone experienced similar issues when integrating Web3Auth with Quasar using Vite?
- Are there any specific configuration changes needed to ensure compatibility between Web3Auth, Vite, and Quasar?
Any insights or suggestions would be highly appreciated!