2

I am building a React-based app that uses many dependencies and I am running into a problem with @metaplex-foundation/js and @solana/spl-token in particular.

I want to use the newest versions of both packages, but the @metaplex-foundation/js package has a transient dependency of an older version of the @solana/spl-token package.

yarn list @solana/spl-token output:

yarn list v1.22.19
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ @metaplex-foundation/[email protected]
│  └─ @metaplex-foundation/[email protected]
│     └─ @solana/[email protected]
├─ @metaplex-foundation/[email protected]
│  └─ @solana/[email protected]
└─ @solana/[email protected]

The problem is that I am trying to use features only available in the 0.3.5 version of spl-token, but it seems to me that I am locked into using 0.2.0. Is there a way for me to work around this?

The error within VS Code

1
  • 1
    It looks like the solution to my problem is using npm/yarn aliases: classic.yarnpkg.com/en/docs/cli/add#toc-yarn-add-alias yarn add @solana/spl-token-next@npm:@solana/spl-token The current problem is that VS Code still doesn't resolve the aliased version as a different package, it still sees it as the 0.2.0 version.
    – pepeIKO
    Commented Oct 25, 2022 at 9:14

1 Answer 1

2

I'm going to add my comment as the answer to this:

It looks like the solution to my problem is using npm/yarn aliases with a command such as yarn add @solana/spl-token-next@npm:@solana/spl-token.

This still has some awkward problems with VS Code in some cases not resolving the aliased version as a different package, but it does work.

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.