From 65620f4976ad88967a8b64792fed5b0667f8e487 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Thu, 3 Nov 2022 20:36:17 +0100 Subject: Webpack: Do not emit errors if devtools open --- src/patcher.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/patcher.ts') diff --git a/src/patcher.ts b/src/patcher.ts index c25505a..4f724cb 100644 --- a/src/patcher.ts +++ b/src/patcher.ts @@ -23,6 +23,7 @@ import { dirname, join } from "path"; import { initIpc } from "./ipcMain"; import { installExt } from "./ipcMain/extensions"; import { readSettings } from "./ipcMain/index"; +import { onceDefined } from "./utils/onceDefined"; console.log("[Vencord] Starting up..."); @@ -74,15 +75,9 @@ require.cache[electronPath]!.exports = { }; // Patch appSettings to force enable devtools -Object.defineProperty(global, "appSettings", { - set: (v: typeof global.appSettings) => { - v.set("DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING", true); - // @ts-ignore - delete global.appSettings; - global.appSettings = v; - }, - configurable: true -}); +onceDefined(global, "appSettings", s => + s.set("DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING", true) +); process.env.DATA_DIR = join(app.getPath("userData"), "..", "Vencord"); -- cgit