Custom sockPath for sockjs-node (HMR) partially fails
See original GitHub issueVersion
3.10.0
Reproduction link
https://github.com/fleebzz/vue-cli-sockjs-path-issue
Environment info
System:
OS: Linux 4.9 Debian GNU/Linux 9 (stretch) 9 (stretch)
CPU: (2) x64 Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz
Binaries:
Node: 12.7.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.10.0 - /usr/local/bin/npm
Browsers:
Chrome: Not Found
Firefox: Not Found
npmPackages:
@vue/babel-helper-vue-jsx-merge-props: 1.0.0
@vue/babel-plugin-transform-vue-jsx: 1.0.0
@vue/babel-preset-app: 3.10.0
@vue/babel-preset-jsx: 1.1.0
@vue/babel-sugar-functional-vue: 1.0.0
@vue/babel-sugar-inject-h: 1.0.0
@vue/babel-sugar-v-model: 1.0.0
@vue/babel-sugar-v-on: 1.1.0
@vue/cli-overlay: 3.10.0
@vue/cli-plugin-babel: ^3.10.0 => 3.10.0
@vue/cli-plugin-eslint: ^3.10.0 => 3.10.0
@vue/cli-service: ^3.10.0 => 3.10.0
@vue/cli-shared-utils: 3.10.0
@vue/component-compiler-utils: 2.6.0 (3.0.0)
@vue/preload-webpack-plugin: 1.1.1
@vue/web-component-wrapper: 1.2.0
eslint-plugin-vue: ^5.0.0 => 5.2.3 (4.7.1)
vue: ^2.6.10 => 2.6.10
vue-eslint-parser: 5.0.0 (2.0.3)
vue-hot-reload-api: 2.3.3
vue-loader: 15.7.1
vue-style-loader: 4.1.2
vue-template-compiler: ^2.6.10 => 2.6.10
vue-template-es2015-compiler: 1.9.1
npmGlobalPackages:
@vue/cli: 3.10.0
Steps to reproduce
- Clone the repo
- Run
yarn serve
- Browse
http://localhost:9090/sub-folder
- Observe in Network pan two requests for sockjs-node :
GET http://localhost:9090/sub-folder/sockjs-node/info
which succeedsGET http://localhost:9090/sockjs-node/info
wich fails
What is expected?
Only one /info
request
What is actually happening?
Two requests to sockjs-node/info
with one ignoring the custom socket path
Second request should not happen and throws a lot of 404 errors in console.
The error seems to come from vue-cli
and not from webpack-dev-server
. See following repository with same behavior but without vue-cli
and only webpack-dev-server
, it works : https://github.com/fleebzz/webpack-sockjs-path-issue.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10
Top Results From Across the Web
Webpack dev server sockjs-node returns 404 error
I believe this module is used by webpack for hot reloading (HMR). The first error is: Access to XMLHttpRequest at 'http://192.168.1.4:8080/ ...
Read more >webpack/webpack - Gitter
It's causing HMR to fail. ... Seems I have to set options.public to localhost:3808/sockjs-node . ... sockPath strangely doesn't let me fix the...
Read more >sockjs-node path is overwritten with webpack-dev-server ...
Coding example for the question sockjs-node path is overwritten with webpack-dev-server ... We can change the default socket path using sockPath option:
Read more >@vue/cli-overlay | Yarn - Package Manager
@vue/cli-overlay. owner vuejs4.2mMIT5.0.8 vulns 0 vulnerabilities. error overlay & dev server middleware for vue-cli. vue, cli, cli-overlay ...
Read more >Migrating from WebpackDevMiddleware to SpaServices ...
Run the app, and HMR should be back in business. ... GET https://localhost:56670/sockjs-node/info?t=1585758023901 net:: ...
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
Workaround:
vue.config.js
apache (my toplevel proxy) conf
nginx/conf.d/default.conf (myNGINX host)
Normal page load, when trying to get webpack chunk
7.js
instead is served index.html (not good)Note that the
request:"GET /testapp/js/7.js HTTP/1.1"
here is for /testapp/ instead of being the root of the containerManual request, serves proper
7.js
file (good)request:"GET /js/7.js HTTP/1.1"
Presumably this means that somewhere along the line, the chunk is being requested at
https://localhost/testapp/testapp/js/7.js
instead ofhttps://localhost/testapp/js/7.js
So I’ll have to either add more exceptions to my dev nginx conf or find out why it’s doubling up my path
EDIT: For now, I’ve simply removed the sockjs-node rules in the apache config. I get
Firefox can’t establish a connection to the server at wss://localhost/testapp/sockjs-node/983/5tge5jvp/websocket.
errors, but the hot-reload works and it’s only relevent in dev anyways. I’ll live with it 😕