diff --git a/bin/index.mts b/bin/index.mts index 79e1b78b5..6370bc871 100755 --- a/bin/index.mts +++ b/bin/index.mts @@ -24,7 +24,7 @@ import { logBuildPlugin } from "../src/util.mjs"; import { sassPlugin } from "esbuild-sass-plugin"; import { fileURLToPath } from "url"; import { AddonType, getAddonFolder, isMonoRepo, selectAddon } from "./mono.mjs"; -import { hostname } from "os"; +import { hostname, platform } from "os"; interface BaseArgs { watch?: boolean; @@ -67,11 +67,19 @@ let ws: WebSocket | undefined; let failed = false; let connectingPromise: Promise | undefined; +function isMac(): boolean { + return platform() === "darwin"; +} + /** * Try to connect to RPC on a specific port and handle the READY event as well as errors and close events */ function tryPort(port: number): Promise { - ws = new WebSocket(`ws://${hostname()}.local:${port}/?v=1&client_id=REPLUGGED-${random()}`); + ws = new WebSocket( + `ws://${ + isMac() ? "localhost" : `${hostname()}.local` + }:${port}/?v=1&client_id=REPLUGGED-${random()}`, + ); return new Promise((resolve, reject) => { let didFinish = false; ws?.on("message", (data) => {