Skip to content

refactor: prevent reinitializing global.$RefreshReg$#1510

Closed
jbroma wants to merge 1 commit intofacebook:mainfrom
callstack:feat/prevent-reinitializing-refresh
Closed

refactor: prevent reinitializing global.$RefreshReg$#1510
jbroma wants to merge 1 commit intofacebook:mainfrom
callstack:feat/prevent-reinitializing-refresh

Conversation

@jbroma
Copy link
Contributor

@jbroma jbroma commented May 30, 2025

Summary

Part of #1480

This PR adds a check for global.$RefreshReg$ to prevent reinitialising it in case there are multiple module systems present in runtime (like it does in the implementation of module-federation in Metro).

For context: for the HMR in MF we're reusing the global instance of ReactRefresh

Changelog: [Internal] Prevent reinitialising global.$RefreshReg$ in require.js polyfill

Test plan

n/a

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels May 30, 2025
@facebook-github-bot
Copy link
Contributor

@robhogan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@robhogan merged this pull request in 15fef8e.

jbroma added a commit to callstack/metro that referenced this pull request Jul 1, 2025
Summary:
Part of facebook#1480

This PR adds a check for global.$RefreshReg$ to prevent reinitialising it in case there are multiple module systems present in runtime (like it does in the implementation of module-federation in Metro).

For context: for the HMR in MF we're reusing the global instance of `ReactRefresh`

<!--
Changelog entries should be prefixed with one of the following scopes:
[Breaking, Feature, Fix, Performance, Deprecated, Experimental, Internal]

Examples:
  Changelog: [Fix] Respond with HTTP 404 when a bundle entry point cannot be resolved
  Changelog: [Internal]
-->
Changelog: [Internal] Prevent reinitialising global.$RefreshReg$ in require.js polyfill

Pull Request resolved: facebook#1510

Test Plan: n/a

Reviewed By: huntie

Differential Revision: D75678288

Pulled By: robhogan

fbshipit-source-id: 2f7eb8ac3b298494b260276b1ab74e35230e3743
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. Merged Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants