web3modal
web3modal copied to clipboard
[bug] Could not resolve "rpc-websockets/dist/lib/client" in @web3modal/solana/react
Link to minimal reproducible example
https://github.com/rtomas/solana-walletconnect-example
Summary
Trying to run a simple example using @web3modal/solana/react as you can see in my github project and having
[ERROR] Could not resolve "rpc-websockets/dist/lib/client"
node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@solana/web3.js/lib/index.browser.esm.js:12:37:
12 │ import RpcWebSocketCommonClient from 'rpc-websockets/dist/lib/client';
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The path "./dist/lib/client" is not exported by package "rpc-websockets":
node_modules/.pnpm/node_modules/rpc-websockets/package.json:5:13:
5 │ "exports": {
╵ ^
You can mark the path "rpc-websockets/dist/lib/client" as external to exclude it from the bundle,
which will remove this error and leave the unresolved path in the bundle.
✘ [ERROR] Could not resolve "rpc-websockets/dist/lib/client/websocket.browser"
node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@solana/web3.js/lib/index.browser.esm.js:13:22:
13 │ import createRpc from 'rpc-websockets/dist/lib/client/websocket.browser';
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The path "./dist/lib/client/websocket.browser" is not exported by package "rpc-websockets":
node_modules/.pnpm/node_modules/rpc-websockets/package.json:5:13:
5 │ "exports": {
╵ ^
You can mark the path "rpc-websockets/dist/lib/client/websocket.browser" as external to exclude it
from the bundle, which will remove this error and leave the unresolved path in the bundle.
List of related npm package versions
"@solana/wallet-adapter-wallets": "^0.19.32",
"@solana/web3.js": "^1.95.0",
"@web3modal/solana": "^5.0.6",
solved when added this package version "rpc-websockets": "7.11.0" (not the last one)
Looks like some packaging issue I uninstalled the "rpc-websockets": "7.11.0", then I removed node_modules -> did pnpm i again and issue hasn't reproduced
this is solved in latest