Error when setting hmrPort in snowpack.config.js
with snowpack template
#2974
Unanswered
jceipek
asked this question in
Troubleshooting
Replies: 1 comment
-
I am also seeing a similar issue. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to use the
hmrPort
dev option referenced here: https://www.snowpack.dev/reference/configuration#devoptions.hmrportbut my browser errors when trying to connect to a web socket at the supplied port, even using a minimally modified snowpack template.
What additional steps do I need to take to get the HMR websocket working on a different port from the dev server?
What I tried:
I created a new test project like this:
and modified
snowpack.config.js
to contain the following:Then I ran
npm start
insidenew-project-directory
. My default browser (Microsoft Edge) opened tolocalhost:9000
and rendered the confetti sample, but the browser console logged an error related to the hmr port:and the dev tools Network tab indicates that the request URL was ws://localhost:9001/ but provides no additional header information. The messages tab for the websocket is blank.
I don't get browser reloads when I modify
index.js
.Context:
with snowpack v2, I had two proxies set up in
snowpack.config.js
, one with a websocket:Snowpack v3 requires you to import
http-proxy
manually, and so I tried this:but I never see
WS REQUEST
logged anywhere and my frontend application can't connect to the socket.Per #2434 (reply in thread) it appears that proxying a websocket also requires you to set
hmrPort
to something different thanport
.Hence my attempt to set hmrPort.
Beta Was this translation helpful? Give feedback.
All reactions