Make jsFactory shorter -> bundle size -10%
This commit is contained in:
parent
56b00f715a
commit
f492d26379
@ -22,7 +22,7 @@ import type Other from "discord-types/other";
|
|||||||
import type Stores from "discord-types/stores";
|
import type Stores from "discord-types/stores";
|
||||||
|
|
||||||
import { lazyWebpack } from "../utils/misc";
|
import { lazyWebpack } from "../utils/misc";
|
||||||
import { _resolveReady, filters, mapMangledModuleLazy,waitFor } from "./webpack";
|
import { _resolveReady, filters, mapMangledModuleLazy, waitFor } from "./webpack";
|
||||||
export const Margins = lazyWebpack(filters.byProps(["marginTop20"]));
|
export const Margins = lazyWebpack(filters.byProps(["marginTop20"]));
|
||||||
|
|
||||||
export let FluxDispatcher: Other.FluxDispatcher;
|
export let FluxDispatcher: Other.FluxDispatcher;
|
||||||
@ -115,7 +115,12 @@ export const Clipboard = mapMangledModuleLazy('document.queryCommandEnabled("cop
|
|||||||
SUPPORTS_COPY: x => typeof x === "boolean",
|
SUPPORTS_COPY: x => typeof x === "boolean",
|
||||||
});
|
});
|
||||||
|
|
||||||
waitFor("useState", m => React = m);
|
waitFor("useState", m => {
|
||||||
|
window._Ve$ = m.createElement;
|
||||||
|
window._VF$ = m.Fragment;
|
||||||
|
React = m;
|
||||||
|
});
|
||||||
|
|
||||||
waitFor(["dispatch", "subscribe"], m => {
|
waitFor(["dispatch", "subscribe"], m => {
|
||||||
FluxDispatcher = m;
|
FluxDispatcher = m;
|
||||||
const cb = () => {
|
const cb = () => {
|
||||||
|
@ -15,8 +15,9 @@
|
|||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"target": "ESNEXT",
|
"target": "ESNEXT",
|
||||||
// https://esbuild.github.io/api/#jsx-factory
|
// https://esbuild.github.io/api/#jsx-factory
|
||||||
"jsxFactory": "Vencord.Webpack.Common.React.createElement",
|
// these short window aliases make the bundle ~10% smaller
|
||||||
"jsxFragmentFactory": "Vencord.Webpack.Common.React.Fragment",
|
"jsxFactory": "_Ve$",
|
||||||
|
"jsxFragmentFactory": "_VF$",
|
||||||
"jsx": "react"
|
"jsx": "react"
|
||||||
},
|
},
|
||||||
"include": ["src/**/*"]
|
"include": ["src/**/*"]
|
||||||
|
Loading…
Reference in New Issue
Block a user