1

error when using local build of @solana/wallet-adapter-react-ui enter image description here

reproduction steps -

git clone https://github.com/solana-labs/wallet-adapter .
pnpm i
pnpm build

in _app.tsx of the nextjs-starter app change line 3

import { WalletModalProvider } from '@solana/wallet-adapter-react-ui';

to use the local build output

import { WalletModalProvider } from '../../../../ui/react-ui';

run next app

cd packages/starter/nextjs-starter
pnpm dev
2
  • You can't just use local paths like that especially in a pnpm project which has strict dependency resolution. Why are you changing that path anyway?
    – Jordan
    Commented Oct 18, 2022 at 4:37
  • i'm facing the same issue when using all imports from local paths. i changed the path here so it's easy to replicate Commented Oct 18, 2022 at 4:39

1 Answer 1

1

Your Stack Exchange post really doesn't explain what you are trying to achieve. In general, just posting an error without any context isn't very helpful.

It sounds like you are attempting to reference files outside of a workspace project directory, perhaps in some other project entirely, for the purpose of modifying those files. This is strictly invalid with pnpm (and with the project's TypeScript config).

Try this:

git clone https://github.com/solana-labs/wallet-adapter --depth=1
cd wallet-adapter
pnpm install
pnpm build

This should succeed, building all packages in the workspace. If you intend to modify the workspace's react-ui package, you can do so.

First, go into the nextjs-starter project's package.json, and change the version of the react-ui package to workspace:^. Then run pnpm install from the root directory.

This will change the nextjs-starter project's dependencies to use your local workspace files for react-ui instead of the published npm version. Then, run this in one terminal:

pnpm watch

This will build all your workspace packages in watch mode.

Run this in a second terminal:

cd packages/starter/nextjs-starter
pnpm dev

This will run the Next.js dev server. Change something in your workspace react-ui package. It will change live in your running Next.js app.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.