[Archive] Modal dependency error with Remix.run

:classical_building: Archived Content from Web3Auth Community

This topic was originally posted by tayvonwright on 4/10/2023.
This content has been migrated from our previous community forum to preserve valuable discussions.


Adding the package and attempting to build the project results in this error:

✘ [ERROR] No matching export in “node_modules/@solana/web3.js/lib/index.browser.esm.js” for import “VersionedTransaction”

node_modules/@web3auth/solana-provider/dist/solanaProvider.esm.js:8:32:
  8 │ ...ublicKey, Connection, VersionedTransaction, Keypair } from '@sol...
    ╵                          ~~~~~~~~~~~~~~~~~~~~

Build failed with 1 error:
node_modules/@web3auth/solana-provider/dist/solanaProvider.esm.js:8:32: ERROR: No matching export in “node_modules/@solana/web3.js/lib/index.browser.esm.js” for import “VersionedTransaction”

Please provide the following details too when asking for help in this category:

  • SDK Version: @web3auth/base & @web3auth/model “5.0.1”
  • Platform: Web Framework — Remix.run
  • Browser Console Screenshots: N/A
  • Related to Custom Authentication? No

Please provide the Web3Auth initialization and login code snippet below:
web3auth.client.ts

import { Web3Auth } from '@web3auth/modal';

export async function initializeWeb3Auth() {
const web3auth = new Web3Auth({
clientId:
/client ID/,
chainConfig: {
chainNamespace: ‘eip155’,
chainId: ‘0x5’,
},
displayErrorsOnModal: true,
});
await web3auth.initModal();
}

root.tsx

...
const [w3AuthInitialized, setW3AuthInitialized] = useState(false);


const initW3Auth = useCallback(async () => {
try {
await initializeWeb3Auth();
} catch (err) {
console.error(err);
}
}, );

useEffect(() => {
if (!w3AuthInitialized) {
initW3Auth();
setW3AuthInitialized(true);
}
}, [w3AuthInitialized, initW3Auth]);

Are you still facing this error?