Skip to content

Commit

Permalink
feat: expose watch option (#889)
Browse files Browse the repository at this point in the history
Summary:
- Metro uses a pretty broad check to disable HMR. This PR exposes the `watch` option so Expo CLI can manually enable/disable file watching, then log to users that HMR is disabled.
- Related expo/expo-cli#4418 (comment)

Pull Request resolved: #889

Test Plan: - flow types

Reviewed By: huntie

Differential Revision: D41081944

Pulled By: jacdebug

fbshipit-source-id: 5f1a0d5c28617eee6f076baee299f7f7c4dd6ca3
  • Loading branch information
EvanBacon authored and facebook-github-bot committed Nov 7, 2022
1 parent 45a1afa commit 8aab3e2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/metro/src/index.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export type RunServerOptions = {
secureCert?: string, // deprecated
secureKey?: string, // deprecated
waitForBundler?: boolean,
watch?: boolean,
websocketEndpoints?: {
[path: string]: typeof ws.Server,
},
Expand Down Expand Up @@ -225,6 +226,7 @@ exports.runServer = async (
secureKey, // deprecated
waitForBundler = false,
websocketEndpoints = {},
watch,
}: RunServerOptions,
): Promise<HttpServer | HttpsServer> => {
await earlyPortCheck(host, config.server.port);
Expand All @@ -246,6 +248,7 @@ exports.runServer = async (
const {middleware, end, metroServer} = await createConnectMiddleware(config, {
hasReducedPerformance,
waitForBundler,
watch,
});

serverApp.use(middleware);
Expand Down

0 comments on commit 8aab3e2

Please sign in to comment.