Auto-assign a port
See original GitHub issueTo properly test the project I’m working on, I need two separate apps running at the same time. I’ve got similar rollup configs for each.
Both are using firebase serve
for their static assets. It has the handy feature of finding its own port if the default one is taken:
[1] ⚠ hosting: Port 5000 is not available. Trying another port...
[1] i hosting: Serving hosting files from: packages/ui/site
[1] ✔ hosting: Local server: http://0.0.0.0:5005
Would you be amenable to a PR that added this feature to rollup-plugin-livereload
?
This passage from the upstream changelog leads me to believe that the plugin is the correct place to fix this:
You can now use server.on ‘error’ in your code to catch the “port in use” message gracefully. The CLI now handles this nicely as well.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Example script to auto assign port using webpack-dev-server
Example script to auto assign port using webpack-dev-server - webpack-port-auto-assign.js.
Read more >C automatically assign port - Stack Overflow
I just wanted to know how to use C to automatically assign a free port (and see what was used) if a specific...
Read more >Automatic port assignment - Continuous Delivery with Docker ...
Automatic port assignment Let's try to run the second Tomcat container without stopping the first one: $ docker run -d -p 8080:8080 ...
Read more >Auto-Assign Port VLAN based on Connected Device (e.g. ...
I have some N3024P switches that need to be set up. There is a requirement to automatically place VOIP phones that are connected...
Read more >To change the port a CMS uses for accepting requests
Under Common Settings, deselect the Auto assign check box for Request Port, then type the port number you want the server to listen...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If this doesn’t add much dependencies, then yes! Could you build the feature with https://github.com/Rich-Harris/port-authority ?
If you just want to solve your problem => assign a random port once per project For example:
livereload({ port: 51823 })
.Checkout out rollup-plugin-livereload@2.0.0 🎉