Fix WebpackModuleRuntime fallback and add React Activity support#296
Merged
Conversation
- 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.
a505fb5 to
bb8afb0
Compare
reshadi
approved these changes
Apr 20, 2026
|
|
||
| const ModuleRuntime: ModuleRuntimeBase = (() => { | ||
| let _moduleRuntime: ModuleRuntimeBase | null = null; | ||
| function getModuleRuntime(): ModuleRuntimeBase { |
Contributor
There was a problem hiding this comment.
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.
Member
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix WebpackModuleRuntime.getExports() crash when module not found in webpack_module_cache (e.g. browser MCP injecting empty cache). Null-safe access gated behind
safeWebpackModuleExportsflag.Convert ModuleRuntime from eager IIFE to lazy getModuleRuntime() so GlobalFlags are respected.
preferMetaModuleRuntimeflag 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.