chrome-extension-tools
chrome-extension-tools copied to clipboard
VITE > 4.3.0 HRM no starting
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
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
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 = "/" || '/';
Same problem!
Having this issue, using SvelteKit.