@solana/web3.js-legacy-sham
This package is a drop-in replacement for a subset of the version 1.x
@solana/web3.js
interfaces. Its goal is to satisfy the legacy interfaces with as little code as possible.
If you depend on web3.js directly then you should not use this. Instead, migrate to version >=2
of @solana/web3.js
.
On the other hand, if you depend on the legacy library transitively through a dependency that you don't control, you can use this sham to satisfy those libraries' dependency on the legacy web3.js interfaces with fewer bytes of JavaScript code.
Usage
- Install the library into your project
npm install --save @solana/web3.js-legacy-sham
- Override your dependencies' dependency on the legacy library in your
package.json
. As an example, imagine that you wish to override the Metaplex token metadata library's dependency on the legacy web3.js.- Using pnpm
overrides
"pnpm": { "overrides": { "@metaplex-foundation/mpl-token-metadata>@solana/web3.js": "npm:@solana/web3.js-legacy-sham" } }
- Using npm
overrides
"overrides": { "@metaplex-foundation/mpl-token-metadata": { "@solana/web3.js": "npm:@solana/web3.js-legacy-sham" } }
- Using yarn
resolutions
"resolutions": { "@metaplex-foundation/mpl-token-metadata/@solana/web3.js": "npm:@solana/web3.js-legacy-sham" }
- Using pnpm