chrome-extension-tools icon indicating copy to clipboard operation
chrome-extension-tools copied to clipboard

VITE > 4.3.0 HRM no starting

Open thyngster opened this issue 1 year ago • 3 comments

Build tool

Vite

Where do you see the problem?

  • [X] In the browser
  • [X] In the terminal

Describe the bug

HRM_PORT is undefined, therefore the HRM doesn't work.

Reproduction

Just create a simple vite + crxjs project.

Created this repo for easing the testing task: https://github.com/thyngster/crxjs-vite430

image

Logs

Uncaught (in promise) DOMException: Failed to construct 'WebSocket': The URL 'ws://localhost:undefined/' is invalid.
    at setupWebSocket (chrome-extension://mljhkmdhnkpmoeeecfgjjmhfjhmmhjoo/@vite/client:245:20)
    at fallback (chrome-extension://mljhkmdhnkpmoeeecfgjjmhfjhmmhjoo/@vite/client:224:22)
    at WebSocket.<anonymous> (chrome-extension://mljhkmdhnkpmoeeecfgjjmhfjhmmhjoo/@vite/client:259:13)

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i5-12600K
    Memory: 15.50 GB / 31.81 GB
  Binaries:
    Node: 18.12.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1555.0), Chromium (112.0.1722.34)
    Internet Explorer: 11.0.22621.1

Severity

annoyance

thyngster avatar Apr 23 '23 11:04 thyngster

These are the current generated client variables:

// use server configuration, then fallback to inference
const serverHost = "localhost:undefined/";
const socketProtocol = null || (importMetaUrl.protocol === 'https:' ? 'wss' : 'ws');
const hmrPort = null;
const socketHost = `${"localhost" || importMetaUrl.hostname}:${hmrPort || importMetaUrl.port}${"/"}`;
const directSocketHost = "localhost:undefined/";
const base = "/" || '/';

thyngster avatar Apr 23 '23 12:04 thyngster

Same problem!

prakhartiwari0 avatar Oct 06 '23 11:10 prakhartiwari0

Having this issue, using SvelteKit.

rusprice avatar Dec 08 '23 03:12 rusprice