diff options
author | Ven <vendicated@riseup.net> | 2022-10-29 20:27:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-29 20:27:48 +0200 |
commit | 93859883c12cbc39e0142840b633fc288e9ecc75 (patch) | |
tree | c18ea313c410f53ae53488b4e27a71af105d902e /src | |
parent | 37105ac416545f1b26f885c3c6c7b98bdce9e2a6 (diff) | |
download | Vencord-93859883c12cbc39e0142840b633fc288e9ecc75.tar.gz Vencord-93859883c12cbc39e0142840b633fc288e9ecc75.tar.bz2 Vencord-93859883c12cbc39e0142840b633fc288e9ecc75.zip |
build: inject createElement alias (#176)
Diffstat (limited to 'src')
-rw-r--r-- | src/components/Settings.tsx | 3 | ||||
-rw-r--r-- | src/globals.d.ts | 9 | ||||
-rw-r--r-- | src/webpack/common.tsx | 6 |
3 files changed, 4 insertions, 14 deletions
diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index e720c6f..b4504a2 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -23,7 +23,6 @@ import { useAwaiter } from "../utils/misc"; import { Alerts, Button, Forms, Margins, Parser, React, Switch } from "../webpack/common"; import ErrorBoundary from "./ErrorBoundary"; import { Flex } from "./Flex"; -import { launchMonacoEditor } from "./Monaco"; export default ErrorBoundary.wrap(function Settings() { const [settingsDir, , settingsDirPending] = useAwaiter(() => VencordNative.ipc.invoke<string>(IpcEvents.GET_SETTINGS_DIR), "Loading..."); @@ -85,7 +84,7 @@ export default ErrorBoundary.wrap(function Settings() { </Flex>} {IS_WEB && <Button - onClick={launchMonacoEditor} + onClick={() => require("./Monaco").launchMonacoEditor()} size={Button.Sizes.SMALL} disabled={settingsDir === "Loading..."} > diff --git a/src/globals.d.ts b/src/globals.d.ts index 49c3659..071bca2 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -16,7 +16,6 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import React from "react"; declare global { /** @@ -49,12 +48,6 @@ declare global { */ export var DiscordNative: any; - // jsFactory, here to make ts happy - /** Shorter alias for React.createElement to reduce bundle size, don't use this. */ - export var _Ve$: typeof React["createElement"]; - /** Shorter alias for React.Fragment to reduce bundle size, don't use this. */ - export var _VF$: typeof React["Fragment"]; - interface Window { webpackChunkdiscord_app: { push(chunk: any): any; @@ -63,3 +56,5 @@ declare global { [k: string]: any; } } + +export { }; diff --git a/src/webpack/common.tsx b/src/webpack/common.tsx index 2f9aaa9..f5b2401 100644 --- a/src/webpack/common.tsx +++ b/src/webpack/common.tsx @@ -115,11 +115,7 @@ export const Clipboard = mapMangledModuleLazy('document.queryCommandEnabled("cop SUPPORTS_COPY: x => typeof x === "boolean", }); -waitFor("useState", m => { - window._Ve$ = m.createElement; - window._VF$ = m.Fragment; - React = m; -}); +waitFor("useState", m => React = m); waitFor(["dispatch", "subscribe"], m => { FluxDispatcher = m; |