webpack-hot-client icon indicating copy to clipboard operation
webpack-hot-client copied to clipboard

Option to set websocket path

Open bryanlarsen opened this issue 7 years ago • 6 comments

Feature Use Case

Using webpack-hot-client under some sort of orchestration system to tie together a bunch of microservers, like an ingress server in minikube or the kubernetes in docker-for-mac

Feature Proposal

Allow the websocket path to be specified both on the client and the server. I'd prefer they both be set the same so I don't need to use url-rewriting.

Current ugly workaround

setting options:

host: {
    server: '0.0.0.0',
    client: 'localhost/hot',
},
port: 3002

and useing the ingress:

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: hot
  annotations:
    kubernetes.io/ingress.class: "nginx"
    ingress.kubernetes.io/ssl-redirect: "false"
    nginx.org/websocket-services: "app"
    nginx.ingress.kubernetes.io/rewrite-target: '/'
spec:
  rules:
  - http:
      paths:
        - path: /hot:3002
          backend:
            serviceName: app
            servicePort: 3002

It's an ugly hack, but by setting host.client to 'localhost/hot', the resulting url is 'ws://localhost/hot:3002'

bryanlarsen avatar Oct 25 '18 19:10 bryanlarsen

@bryanlarsen do you use webpack-serve? If yes, webpack-serve deprecated

alexander-akait avatar Oct 25 '18 19:10 alexander-akait

I'm using koa-webpack.

bryanlarsen avatar Oct 25 '18 21:10 bryanlarsen

@bryanlarsen doesn't support officially

alexander-akait avatar Oct 25 '18 22:10 alexander-akait

koa-webpack is just a thin shim over webpack-serve, so I don't mind using it directly if that helps.

bryanlarsen avatar Oct 26 '18 18:10 bryanlarsen

What is the correct way to use this package? With webpack-dev-server?

ozyman42 avatar Nov 20 '18 08:11 ozyman42

@AlexLeung The opposite. Was created to replace WDS when it got stagnant. But then it got going again. Well webpack-serve was, and this is it's HMR package, counterpart to WDS's webpack-hot-middleware.

At least i think i got all that right. I just started with this stuff yesterday and am still failing at getting HMR running for an app that has a non javascript backend (python).

j-walker23 avatar Dec 06 '18 12:12 j-walker23