Skip to content

Commit a122a01

Browse files
fix: handle localhost hostname in constructInspectorWSUri function (#2260)
1 parent c004ba6 commit a122a01

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/targets/browser/constructInspectorWSUri.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ export function constructInspectorWSUri(
2929

3030
// We map keys to functions, so we won't fail with a missing url unless the inspector uri format is actually referencing the url
3131
const replacements: { [key: string]: () => string } = {
32-
'url.hostname': () => getUrl(urlText).hostname,
32+
'url.hostname': () => {
33+
const hostname = getUrl(urlText).hostname;
34+
return hostname.endsWith('.localhost') ? 'localhost' : hostname;
35+
},
3336
'url.port': () => getUrl(urlText).port,
3437
browserInspectUri: () => encodeURIComponent(browserInspectUri),
3538
browserInspectUriPath: () => new URL(browserInspectUri).pathname,

0 commit comments

Comments
 (0)