Using two different versions of the same node dependency

Is there a way to include two versions of the same dependency in nodejs package.json?

For testing purposes, I need to use two versions of socket.io (one to display the socket in the latest version and one to simulate the dependency server using the old version).

{ "dependencies": { "socket.io": "~0.9.0", "socket.io": "~1.2.0" } }

+6
source share
1 answer

This may not be the best solution, but you can first fork socket.io 0.9 on github: https://github.com/Automattic/socket.io/tree/0.9

To create https://github.com/youaccount/socket.io/tree/0.9

Then use this:

 "dependencies": { "oldsocket.io": "git+ssh:// git@github.youaccount /socket.io.git#0.9", "socket.io": "~1.2.0" } 

Edit package.json and rename the name attribute to oldsocket.io

And now you can require socket.io or oldsocket.io

+1
source

Source: https://habr.com/ru/post/977837/


All Articles