diff --git a/.changeset/twenty-bushes-act.md b/.changeset/twenty-bushes-act.md new file mode 100644 index 000000000..0c0292cbf --- /dev/null +++ b/.changeset/twenty-bushes-act.md @@ -0,0 +1,5 @@ +--- +"@callstack/repack": major +--- + +Fix Android dev-server URLs on physical devices by preserving `localhost` instead of rewriting it to `10.0.2.2`. diff --git a/packages/repack/src/modules/getDevServerLocation.ts b/packages/repack/src/modules/getDevServerLocation.ts index 88893043d..cbc0e1fc0 100644 --- a/packages/repack/src/modules/getDevServerLocation.ts +++ b/packages/repack/src/modules/getDevServerLocation.ts @@ -1,14 +1,8 @@ -let hostname = __PUBLIC_HOST__; - -if (__PLATFORM__ === 'android' && __PUBLIC_HOST__ === 'localhost') { - hostname = '10.0.2.2'; -} - const location = { - host: `${hostname}:${__PUBLIC_PORT__}`, - hostname, - href: `${__PUBLIC_PROTOCOL__}://${hostname}:${__PUBLIC_PORT__}/`, - origin: `${__PUBLIC_PROTOCOL__}://${hostname}:${__PUBLIC_PORT__}`, + host: `${__PUBLIC_HOST__}:${__PUBLIC_PORT__}`, + hostname: __PUBLIC_HOST__, + href: `${__PUBLIC_PROTOCOL__}://${__PUBLIC_HOST__}:${__PUBLIC_PORT__}/`, + origin: `${__PUBLIC_PROTOCOL__}://${__PUBLIC_HOST__}:${__PUBLIC_PORT__}`, pathname: '/', port: __PUBLIC_PORT__, protocol: __PUBLIC_PROTOCOL__,