Skip to content

Fix WebpackModuleRuntime fallback and add React Activity support#296

Merged
schwartzmx merged 1 commit into
facebook:mainfrom
schwartzmx:activity-webpack
Apr 21, 2026
Merged

Fix WebpackModuleRuntime fallback and add React Activity support#296
schwartzmx merged 1 commit into
facebook:mainfrom
schwartzmx:activity-webpack

Conversation

@schwartzmx

Copy link
Copy Markdown
Member
  • Fix WebpackModuleRuntime.getExports() crash when module not found in webpack_module_cache (e.g. browser MCP injecting empty cache). Null-safe access gated behind safeWebpackModuleExports flag.

  • Convert ModuleRuntime from eager IIFE to lazy getModuleRuntime() so GlobalFlags are respected. preferMetaModuleRuntime flag controls whether Meta's __debug runtime is checked before webpack's cache.

  • Add REACT_ACTIVITY_TYPE (0xeae8) to IReactConsts, fix broken SymbolFor call, and register in visitor vtable to suppress "optimized visitors missing entry for Symbol(react.activity)" warnings.

  • Upgrade react-testapp to React 19 canary with real component test and Vite __debug exclusion.

@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 Apr 14, 2026
- Fix WebpackModuleRuntime.getExports() crash when module not found in
  __webpack_module_cache__ (e.g. browser MCP injecting empty cache).
  Null-safe access gated behind `safeWebpackModuleExports` flag.

- Convert ModuleRuntime from eager IIFE to lazy getModuleRuntime() so
  GlobalFlags are respected. `preferMetaModuleRuntime` flag controls
  whether Meta's __debug runtime is checked before webpack's cache.

- Add REACT_ACTIVITY_TYPE (0xeae8) to IReactConsts, fix broken
  SymbolFor call, and register in visitor vtable to suppress
  "optimized visitors missing entry for Symbol(react.activity)" warnings.

- Upgrade react-testapp to React 19 canary with real <Activity>
  component test and Vite __debug exclusion.

const ModuleRuntime: ModuleRuntimeBase = (() => {
let _moduleRuntime: ModuleRuntimeBase | null = null;
function getModuleRuntime(): ModuleRuntimeBase {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you expect this function to return different values on different invocations? For example, it may fail to get a _moduleRuntime for a while and then it starts working?

If the answer is no, then the previous pattern is better since it replaces the unnecessary check and is slightly faster.

@schwartzmx schwartzmx Apr 21, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't expect it to change, I wanted to be able to check the global flag just for added safety - which isn't set if this is invoked immediately. When we remove the flags I can revert back. If you think this flag isn't totally necessary I could just swap the order to prefer meta modules, and keep the same pattern without a flag.

@schwartzmx schwartzmx merged commit 2494ab7 into facebook:main Apr 21, 2026
2 checks passed
@schwartzmx schwartzmx deleted the activity-webpack branch April 21, 2026 19:51
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants