Skip to content

Skip HMR client setup when bundle is not from Metro - #58428

Open
javache wants to merge 1 commit into
react:mainfrom
javache:export-D110603320
Open

Skip HMR client setup when bundle is not from Metro#58428
javache wants to merge 1 commit into
react:mainfrom
javache:export-D110603320

Conversation

@javache

@javache javache commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary:
When the JS bundle is loaded from a local file (bundled with the app or restored from disk), HMRClient.setup() still runs during startup and registers an entry-point with the packager over the fallback /hot?bundleEntry=... URL. There is no coherent module map to hot-reload against, so the packager side logs an "Unable to resolve module" error.

Gate setup() on getDevServer().bundleLoadedFromServer and early-return with a console.warn when the bundle did not come from Metro. The user still sees why HMR is unavailable in this session, but the noisy resolver error goes away.

Changelog:
[General][Fixed] - Skip HMR client setup when the JS bundle was not loaded from Metro

Differential Revision: D110603320

Summary:
When the JS bundle is loaded from a local file (bundled with the app or restored from disk), `HMRClient.setup()` still runs during startup and registers an entry-point with the packager over the fallback `/hot?bundleEntry=...` URL. There is no coherent module map to hot-reload against, so the packager side logs an "Unable to resolve module" error.

Gate `setup()` on `getDevServer().bundleLoadedFromServer` and early-return with a `console.warn` when the bundle did not come from Metro. The user still sees why HMR is unavailable in this session, but the noisy resolver error goes away.

Changelog:
[General][Fixed] - Skip HMR client setup when the JS bundle was not loaded from Metro

Differential Revision: D110603320
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 9, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels Sep 9, 2026
@meta-codesync

meta-codesync Bot commented Sep 9, 2026

Copy link
Copy Markdown

@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D110603320.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant