Skip to content

Commit

Permalink
Update default server port to 8081
Browse files Browse the repository at this point in the history
Summary:
For some time, React Native's Metro port default (8081), and Metro's own default port number (8080) have been misaligned. This change aligns these, which should remove this potential gotcha and will simplify config in React Native CLI + `react-native/metro-config`.

Changelog: **[Breaking]** Update default server port to 8081

Reviewed By: robhogan

Differential Revision: D47290078

fbshipit-source-id: 29c910b351746b247b11be944923bcb910d1a774
  • Loading branch information
huntie authored and facebook-github-bot committed Jul 7, 2023
1 parent 2150fb0 commit 891fe96
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Object {
},
"server": Object {
"enhanceMiddleware": [Function],
"port": 8080,
"port": 8081,
"rewriteRequestUrl": [Function],
"runInspectorProxy": true,
"unstable_serverRoot": null,
Expand Down Expand Up @@ -277,7 +277,7 @@ Object {
},
"server": Object {
"enhanceMiddleware": [Function],
"port": 8080,
"port": 8081,
"rewriteRequestUrl": [Function],
"runInspectorProxy": true,
"unstable_serverRoot": null,
Expand Down Expand Up @@ -455,7 +455,7 @@ Object {
},
"server": Object {
"enhanceMiddleware": [Function],
"port": 8080,
"port": 8081,
"rewriteRequestUrl": [Function],
"runInspectorProxy": true,
"unstable_serverRoot": null,
Expand Down Expand Up @@ -633,7 +633,7 @@ Object {
},
"server": Object {
"enhanceMiddleware": [Function],
"port": 8080,
"port": 8081,
"rewriteRequestUrl": [Function],
"runInspectorProxy": true,
"unstable_serverRoot": null,
Expand Down
2 changes: 1 addition & 1 deletion packages/metro-config/src/defaults/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const getDefaultValues = (projectRoot: ?string): ConfigT => ({

server: {
enhanceMiddleware: (middleware, _) => middleware,
port: 8080,
port: 8081,
rewriteRequestUrl: url => url,
runInspectorProxy: true,
unstable_serverRoot: null,
Expand Down
2 changes: 1 addition & 1 deletion packages/metro/src/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports = (): {
});

yargs.option('host', {alias: 'h', type: 'string', default: 'localhost'});
yargs.option('port', {alias: 'p', type: 'number', default: 8080});
yargs.option('port', {alias: 'p', type: 'number', default: 8081});

yargs.option('max-workers', {alias: 'j', type: 'number'});

Expand Down

0 comments on commit 891fe96

Please sign in to comment.