I am trying to get webpack-dev-server
auto-reload a script I am writing to run as userscript in Tampermonkey with the webpack-userscript
plugin. I suspect the problem is that the script does run in an external website and not on localhost, so I don't know if this is possible at all.
I observed that the script is trying to make requests to https://<external website host>:8080/sockjs-node/
instead of ws://localhost:8080/sockjs-node
. I tried to use a proxy in the dev-server config, but it doesn't work and I'm not sure if this is actually the right approach.
devServer: {
contentBase: path.join(__dirname, 'dist'),
proxy: {
'/sockjs-node': {
target: 'ws://localhost:8080',
secure: false,
ws: true,
},
},
},
One thing I observed after setting up the proxy the request changed from https://<external website host>:8080/sockjs-node/
to https://localhost:8080/sockjs-node/
and now it continues to request https://localhost:8080/sockjs-node/
even when I remove the proxy.