No, you cannot run HMR directly on the developement server with sapper, you need two ports, sapper’s configuration asks for two different ports (–port and --dev-port), and if you type the same pourt, you get E_ADDRINUSE
Hi there @superboss224!
Consider making a post in #feature-ideas asking for the ability to open more ports in Glitch containers to people can vote on the idea. Unless it is already a feature and I just don’t know about it
Eddie
You can have more ports by adding a proxy to your server. There is multiple methods. If you use express-http-proxy, here’s an example you can use easily :
const http = require('http')
const express = require('express');
const proxy = require("express-http-proxy");
const app = express();
const server = http.createServer(app).listen(process.env.PORT, () => {
console.log('Listening...on port 3000');
});
app.use("/port/"+LocalPort, proxy("http://localhost:"+LocalPort));
//it redirects all requests to https://blabla.glitch.me/port/4000 to the internal port 4000 (it can be an other port, LocalPort is a variable holding the port number you want to use, in this case its value is 4000)
Then if you listen to the Port 4000 you will automatically listen to the internal port 4000 and it will work like a charm.
I had to use this for a Discord bot where the library required me to listen to a port for each Twitch streamer (I was listening to webhooks with twitch-channel, an NPM package). But to listen to multiple streamers I needed multiple ports. So I ultimately needed to proxy stuff.