aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build/build.mjs4
-rw-r--r--scripts/build/buildWeb.mjs2
-rw-r--r--scripts/build/common.mjs12
3 files changed, 10 insertions, 8 deletions
diff --git a/scripts/build/build.mjs b/scripts/build/build.mjs
index a4b06f5..45cda74 100755
--- a/scripts/build/build.mjs
+++ b/scripts/build/build.mjs
@@ -80,7 +80,7 @@ await Promise.all([
globalName: "Vencord",
sourcemap,
plugins: [
- globPlugins,
+ globPlugins("discordDesktop"),
...commonOpts.plugins
],
define: {
@@ -114,7 +114,7 @@ await Promise.all([
globalName: "Vencord",
sourcemap,
plugins: [
- globPlugins,
+ globPlugins("vencordDesktop"),
...commonOpts.plugins
],
define: {
diff --git a/scripts/build/buildWeb.mjs b/scripts/build/buildWeb.mjs
index df75d35..98d56b0 100644
--- a/scripts/build/buildWeb.mjs
+++ b/scripts/build/buildWeb.mjs
@@ -38,7 +38,7 @@ const commonOptions = {
format: "iife",
external: ["plugins", "git-hash", "/assets/*"],
plugins: [
- globPlugins,
+ globPlugins("web"),
...commonOpts.plugins,
],
target: ["esnext"],
diff --git a/scripts/build/common.mjs b/scripts/build/common.mjs
index 53eb23f..7ff599a 100644
--- a/scripts/build/common.mjs
+++ b/scripts/build/common.mjs
@@ -48,9 +48,9 @@ export const makeAllPackagesExternalPlugin = {
};
/**
- * @type {import("esbuild").Plugin}
+ * @type {(kind: "web" | "discordDesktop" | "vencordDesktop") => import("esbuild").Plugin}
*/
-export const globPlugins = {
+export const globPlugins = kind => ({
name: "glob-plugins",
setup: build => {
const filter = /^~plugins$/;
@@ -76,8 +76,10 @@ export const globPlugins = {
if (fileBits.length > 2 && ["ts", "tsx"].includes(fileBits.at(-1))) {
const mod = fileBits.at(-2);
if (mod === "dev" && !watch) continue;
- if (mod === "web" && !isWeb) continue;
- if (mod === "desktop" && isWeb) continue;
+ if (mod === "web" && kind === "discordDesktop") continue;
+ if (mod === "desktop" && kind === "web") continue;
+ if (mod === "discordDesktop" && kind !== "discordDesktop") continue;
+ if (mod === "vencordDesktop" && kind !== "vencordDesktop") continue;
}
const mod = `p${i}`;
@@ -93,7 +95,7 @@ export const globPlugins = {
};
});
}
-};
+});
/**
* @type {import("esbuild").Plugin}