Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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