@hubspot/cms-dev-server infinite with islands

I think I found a bug in @hubspot/cms-dev-server when using CMS React islands through the HubSpot sprocket “Local dev server” URL.

What I noticed:

  • Pages without islands are stable.
  • Pages with React islands can repeatedly refresh.
  • The refresh loop causes repeated proxy renders and can eventually hit HubSpot account rate limits if multiple modules with islands are on the page.

The browser console showed Vite trying to connect HMR to a websocket on the proxied page hostname:

wss://<live-page-host>.hslocal.net:24678/?token=...

That websocket failed. Vite then started polling/reloading, which caused the dev server to proxy-render the page repeatedly.

Connecting HMR to this host worked instead:

wss://hslocal.net:24678

Local workaround that fixed it was forcing the Vite HMR host:

hmr: {
  protocol: sslEnabled ? "wss" : void 0,
  host: "[hslocal.net](http://hslocal.net)"
}

Hi @John,

Thank you for posting to the Community!

Our team is looking into this internally – I will keep you updated once it’s resolved :slight_smile:

Thank you for flagging!

Cassie, Community Manager