Open Gozala opened 8 years ago
As per #11, this should work if you use the --url and --port options together. Please let me know if that doesn't seem to be the case or if you have any other trouble!
@AgentME well the problem is that multiple web socket servers are started with the same port and the second one obviously fails. I do not see how --url
or --port
options would resolve this.
Oh, you want multiple bundles hosted from the same port. Sorry, I mixed this issue up with #11 a bit.
Each is bundled with a separate browserify + watchify bundle and both use hmr plugin for hot reloading.
Note that this could only work if both browserify builds were running in the same process. Making multiple builds rely on shared process state (the same socket server) bothers me a bit (if you tried to run each of the builds separately instead of all together in the same process, then it would fail as each tried to start a socket server on the same port). But then I do eventually want to make a production-friendly implementation of the socket server, and having virtual hosts -like functionality where one server can answer for multiple bundles does seem necessary for that.
I'll make the key
option do what you expected and allow multiple bundles to be served from the same socket server.
Any update on this ? Most wanted feature ! :)
Hello @JulesWang , I'm gonna try your version and I'll let you know!
Has any progress been made on multiple bundle support?
Hey @scottbedard, wondering the same here... But i guess not.
So far i've solved it by letting all my instances use the 'main' socket. So none of them will serve their own socket, just listening to the main one.
So the ones listening on the main will get:
watchify -vd -p [ browserify-hmr --noServe true -p 8888 -u localhost:8888] -e main.js -o bundle.js
And the main one will get:
watchify -vd -p [ browserify-hmr -p 8888 -u localhost:8888 ] -e main.js -o bundle.js
Notice the --noServe while still added the port and url of the main socket.
Hope this helps, abit
@w0bbes Nice, that's an interesting solution. I ended up just switching to webpack, it makes more sense for my project anyway.
This hasn't been worked on yet. Being able to host multiple from the same port would be a neat feature, but I think some of the demand for the feature is misplaced. You can build different bundles with different instances of browserify-hmr running on different ports right now.
Yep we are running 4 instances of watchify with browserify-hmr in parallel, each with a different port for 4 different apps. Would be nice if they could all listen to the same hmr server, especially when adding another bundle, then I wouldn't have to launch another hmr server
Yep, Most wanted feature, seems still no progress~
In my use case my application code consists of multiple bundles, for simplicity let's say two one for code running in main thread and other for web-worker thread. Each is bundled with a separate browserify + watchify bundle and both use hmr plugin for hot reloading.
As far as I can understand from error messages below second bundle is attempting to start a second hmr server which errors:
It would be nice if somehow multiple bundles could share same HMR instance. I also tried documented
key
parameter but that seems to fail due to #11 although not sure if that is what's it intended for.Use of different port and url options per bundle works although I don't find it to be an ideal.