Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Can't resolve 'aptos_dynamic_transaction_composer_bg.wasm' #447

Open
JatSh1804 opened this issue Nov 10, 2024 · 4 comments

Comments

@JatSh1804
Copy link

JatSh1804 commented Nov 10, 2024

Have been trying to use the @aptos-wallet-adapter for the last two days, and couldn't get any success.
Error:

``Module not found: Can't resolve 'aptos_dynamic_transaction_composer_bg.wasm'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/@aptos-labs/ts-sdk/dist/esm/chunk-4PBXTMN3.mjs
./node_modules/@aptos-labs/ts-sdk/dist/esm/index.mjs
./node_modules/@aptos-labs/wallet-adapter-react/node_modules/@aptos-labs/wallet-adapter-core/dist/index.mjs
./node_modules/@aptos-labs/wallet-adapter-react/dist/index.mjs
./app/profile/page.tsx``

Have tried to setup new repo with the latest nextjs version, but still the same error.
/app/profile/layout.tsx

'use client'

import { PropsWithChildren } from 'react'
import { PetraWallet } from 'petra-plugin-wallet-adapter'
import { AptosWalletAdapterProvider } from '@aptos-labs/wallet-adapter-react'
import { WalletSelector } from '@aptos-labs/wallet-adapter-ant-design'
import React from 'react'
import {
  // Aptos,
  // AptosConfig,
  Network,
  // APTOS_COIN,
  // AccountAddressInput,
} from '@aptos-labs/ts-sdk'

const wallets = [new PetraWallet()]
export default function RootLayout({ children }: PropsWithChildren) {
  return (
    <body className="grow">
      <AptosWalletAdapterProvider
        plugins={wallets}
        autoConnect={true}
        dappConfig={{
          network: Network.TESTNET,
          aptosConnectDappId: 'dapp-id',
        }}
      >
        <WalletSelector />
        <div className="mt-16">{children}</div>
      </AptosWalletAdapterProvider>
    </body>
  )
}

/app/profile/page.tsx

import { useWallet, WalletName } from "@aptos-labs/wallet-adapter-react"

const { connect, disconnect, account, connected } = useWallet();
 const handleConnect = async () => {
        try {
            // Change below to the desired wallet name instead of "Petra"
            await connect("Petra" as WalletName<"Petra">);
            console.log('Connected to wallet:', account);
        } catch (error) {
            console.error('Failed to connect to wallet:', error);
        }
    };
    const handleDisconnect = async () => {
        try {
            await disconnect();
            console.log('Disconnected from wallet');
        } catch (error) {
            console.error('Failed to disconnect from wallet:', error);
        }
    };

Have also tried updating the next.config.mjs to allow loading the .wasm file on client side but it's just compiling the route, nothing else.
Stack: NextJs 14 (app router)

@criox4
Copy link

criox4 commented Nov 10, 2024

I have the same issue for the past few days ..

@JatSh1804
Copy link
Author

I have the same issue for the past few days ..

It's so frustrating i've even initialized new repos but nothing seems to be working on my system. Even the cloned repo seems to be having this error, Have you tried it?? Btw, are you developing this for the dAppathon by any chance??

@criox4
Copy link

criox4 commented Nov 10, 2024

I have the same issue for the past few days ..

It's so frustrating i've even initialized new repos but nothing seems to be working on my system. Even the cloned repo seems to be having this error, Have you tried it?? Btw, are you developing this for the dAppathon by any chance??

Even my previous commits are failing to build. I have scoured the net but to no avail. Let's wait for the devs to reply on this.

No no.. Its not for a hackathon. We are creating a web3 application that facilitates transactions, swaps, trades, and bridges, supporting all blockchains.

@0xmaayan
Copy link
Collaborator

0xmaayan commented Nov 12, 2024

Hi, thanks for reporting this! The issue was related to a bug in the new Aptos ts-sdk version released a few days ago. We've now released an updated version with a fix (1.32.1), which should resolve the issue.

See related aptos-labs/aptos-ts-sdk#573

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants