[Init] Assign window object before everything else

This commit is contained in:
Beef 2023-01-01 21:10:09 +00:00
parent 276cd18a5b
commit 48138c5b7c
3 changed files with 12 additions and 6 deletions

View file

@ -1,5 +1,6 @@
import { build } from "esbuild";
import alias from "esbuild-plugin-alias";
import esg from "esbuild-plugin-external-global";
import fs from "fs/promises";
import path from "path";
@ -13,9 +14,13 @@ try {
minify: true,
bundle: true,
format: "iife",
external: ["react", "react-native"],
target: "esnext",
plugins: [alias(aliases)],
plugins: [
alias(aliases),
esg.externalGlobalPlugin({
"react": "window.React",
})
],
legalComments: "external",
});

View file

@ -19,6 +19,7 @@
"@types/react-native": "^0.70.5",
"esbuild": "^0.15.11",
"esbuild-plugin-alias": "^0.2.1",
"esbuild-plugin-external-global": "^1.0.1",
"redux": "^4.2.0",
"typescript": "^4.8.4",
"zustand": "^4.1.2"

View file

@ -19,10 +19,6 @@ async function init() {
let erroredOnLoad = false;
try {
initSettings();
patchAssets();
patchLogHook();
window.vendetta = {
patcher: patcher,
metro: { ...metro, common: { ...common } },
@ -48,6 +44,10 @@ async function init() {
},
logger: logger,
};
initSettings();
patchAssets();
patchLogHook();
} catch (e: Error | any) {
erroredOnLoad = true;
alert(`Vendetta failed to initialize...\n${e.stack || e.toString()}`);