parent
87cfc742f6
commit
78c303b5f5
2 changed files with 8 additions and 1 deletions
|
|
@ -66,6 +66,11 @@ if (typeof globalThis.__r !== "undefined") {
|
|||
_requireFunc = function patchedRequire(a: number) {
|
||||
// Initializing index.ts(x)
|
||||
if (a === 0) {
|
||||
// https://github.com/facebook/metro/commit/1361405ffe6f1bdef54295addfef0f30523aaab2
|
||||
if (window.modules instanceof Map) {
|
||||
window.modules = Object.fromEntries([...window.modules]);
|
||||
}
|
||||
|
||||
onceIndexRequired(v);
|
||||
_requireFunc = v;
|
||||
} else return v(a);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ import { ModuleFlags, ModulesMapInternal } from "./enums";
|
|||
const { before, instead } = require("spitroast");
|
||||
|
||||
export const metroModules: Metro.ModuleList = window.modules;
|
||||
const metroRequire: Metro.Require = window.__r;
|
||||
// Since modules registry is now a Map, the id is now strictly a number
|
||||
// Making the codebase to adapt to this change would be more ideal, though
|
||||
const metroRequire = (id: number | string) => window.__r(+id);
|
||||
|
||||
// eslint-disable-next-line func-call-spacing
|
||||
const moduleSubscriptions = new Map<number, Set<() => void>>();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue