Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can webpack-dev-server run on a unix domain sockets?

We have a central server on which we host the environments of all our developers. We have nginx running which proxies requests to uwsgi application servers.

We have now started using webpack and we will end up running webpack-dev-server per developer. What I want to do is make webpack-dev-server run on a unix socket (so that we are not eating up ports) and proxy all the requests to this webpack-dev-server via nginx.

I was looking at the webpack-dev-server code on github and noticed that it accepts only a host and port as options.

Has anyone tried doing this before?

like image 240
snr Avatar asked Nov 10 '22 02:11

snr


1 Answers

It's not pretty, but if you pass the socket path as the --port argument it should work.

Example: webpack-dev-server --port tmp/webpack_socket

It works because port is the first parameter passed to server.listen. Here's a snippet from the webpack-dev-server.js file where the server is started:

new Server(...).listen(options.port, options.host, function(err) {
  ...
});
like image 67
jshkol Avatar answered Jan 04 '23 03:01

jshkol