Skip to content

Commit

Permalink
Back out "chore(dev-middleware): add localhost as default host in `…
Browse files Browse the repository at this point in the history
…start` command config" (#44800)

Summary:
Pull Request resolved: #44800

This is a revert of #44244, as we've observed [breaking behaviour](#44244 (comment)) where Android emulators could not connect to the dev server with default settings.

The team doesn't have bandwidth/prio to figure this out with the default `host` value just now, so we are reverting.

Changelog: [Internal] (Nullifies c402dcf)

Reviewed By: cipolleschi

Differential Revision: D58192651

fbshipit-source-id: dd2183d6baa6499ab59e21365adfe62e7a786dfc
  • Loading branch information
huntie authored and facebook-github-bot committed Jun 5, 2024
1 parent eba1828 commit a569c82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/community-cli-plugin/src/commands/start/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const startCommand: Command = {
},
{
name: '--host <string>',
default: 'localhost',
default: '',
},
{
name: '--projectRoot <path>',
Expand Down
7 changes: 4 additions & 3 deletions packages/community-cli-plugin/src/commands/start/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type StartCommandArgs = {
cert?: string,
customLogReporterPath?: string,
experimentalDebugger: boolean,
host: string,
host?: string,
https?: boolean,
maxWorkers?: number,
key?: string,
Expand Down Expand Up @@ -63,13 +63,14 @@ async function runServer(
projectRoot: args.projectRoot,
sourceExts: args.sourceExts,
});
const hostname = args.host?.length ? args.host : 'localhost';
const {
projectRoot,
server: {port},
watchFolders,
} = metroConfig;
const protocol = args.https === true ? 'https' : 'http';
const devServerUrl = url.format({protocol, hostname: args.host, port});
const devServerUrl = url.format({protocol, hostname, port});

logger.info(`Welcome to React Native v${ctx.reactNativeVersion}`);

Expand Down Expand Up @@ -103,7 +104,7 @@ async function runServer(
messageSocketEndpoint,
eventsSocketEndpoint,
} = createDevServerMiddleware({
host: args.host,
host: hostname,
port,
watchFolders,
});
Expand Down

0 comments on commit a569c82

Please sign in to comment.