1
  • I use a lib called rainbowkit, who needs a specific version of a package.
  • I need the latest version(0.7.5) of this package because it may fix a bug I encounter.

enter image description here

Is this even possible ? How ? What are the best practices in this case ?

Fabien
  • 97
  • 8

1 Answers1

1

Why just don't use the latest version of the package? It's not clear why you need different versions?

Still you can use dependencies aliases for this purpose two have to different versions of the same package within the same project by installing the package by this command:

npm i --save aliasName@npm:npmjsPacakgeName@version

For example:

npm i --save swiper1@npm:react-native-swiper@1.6.0

Which will generate a dependency with alias within package.json like this:

"dependencies": {
  "swiper1": "npm:react-native-swiper@^1.6.0"
}

Then, you just can import from swiper1 from your code source

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
aabumousa
  • 66
  • 2