InjectiveLabs / injective-ts

Collection of TypeScript packages that consume and interact with the Injective Chain
Apache License 2.0
130 stars 195 forks source link

Build failed because of lack of `wallet-ts` dependency. #409

Closed happyeric77 closed 8 months ago

happyeric77 commented 8 months ago

Hey team,

The next.js project in which we use the wallet-ts package always fails to build with the error saying Module not found: Can't resolve '@trezor/connect-common/src/messageChannel/abstract'. Please check the detailed msg below:

○ Compiling / ...
 ⨯ ../../node_modules/@injectivelabs/wallet-ts/node_modules/@trezor/connect-web/lib/channels/serviceworker-window.js:4:19
Module not found: Can't resolve '@trezor/connect-common/src/messageChannel/abstract'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
../../node_modules/@injectivelabs/wallet-ts/node_modules/@trezor/connect-web/lib/popup/index.js
../../node_modules/@injectivelabs/wallet-ts/node_modules/@trezor/connect-web/lib/index.js
../../node_modules/@injectivelabs/wallet-ts/dist/esm/strategies/wallet-strategy/strategies/Trezor/index.js
../../node_modules/@injectivelabs/wallet-ts/dist/esm/strategies/wallet-strategy/WalletStrategy.js
../../node_modules/@injectivelabs/wallet-ts/dist/esm/strategies/wallet-strategy/index.js
../../node_modules/@injectivelabs/wallet-ts/dist/esm/strategies/index.js
../../node_modules/@injectivelabs/wallet-ts/dist/esm/index.js
./src/context/wallet/WalletProvider.tsx
./src/app/page.tsx
<w> [webpack.cache.PackFileCacheStrategy] Restoring pack failed from /Users/macbookpro4eric/Projects/notifi/notifi-sdk-ts/packages/notifi-dapp-example/.next/cache/webpack/client-development-fallback.pack.gz: Error: incorrect data check
<w> [webpack.cache.PackFileCacheStrategy] Restoring pack failed from /Users/macbookpro4eric/Projects/notifi/notifi-sdk-ts/packages/notifi-dapp-example/.next/cache/webpack/client-development-fallback.pack.gz: Error: incorrect data check
 ⨯ ../../node_modules/@injectivelabs/wallet-ts/node_modules/@trezor/connect-web/lib/channels/serviceworker-window.js:4:19

Might I know if it is something package dependency issue. Or did I miss anything?

My env FYI:

package.json dependency list FYI:

{
  "name": "injective-wallet",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "react": "^18",
    "react-dom": "^18",
    "next": "14.1.2",
    "@injectivelabs/sdk-ts": "^1.14.6",
    "@injectivelabs/ts-types": "^1.14.6",
    "@injectivelabs/networks": "^1.14.6",
    "@injectivelabs/utils": "^1.14.6",
    "@injectivelabs/wallet-ts": "^1.14.6"
  },
  "devDependencies": {
    "typescript": "^5",
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "autoprefixer": "^10.0.1",
    "postcss": "^8",
    "tailwindcss": "^3.3.0"
  }
}

I created a new nextjs project to replicate this situation. It is a plain create-next-app with some injective package (above). You will be able to replicate this issue by

git clone git@github.com:eric-notifi/injective-wallet.git
npm install
npm run dev

Then we will be able to see below window when accessing localhost:3000.

Screenshot 2024-03-05 at 12 33 10

bangjelkoski commented 8 months ago

Pending resolving from Trezor's side https://github.com/trezor/trezor-suite/pull/11443

bangjelkoski commented 8 months ago

They've released a new version, updating now and will republish the packages.

bangjelkoski commented 8 months ago

Here is the package version of the fixed package @injectivelabs/wallet-ts: 1.14.11-beta.3