From 20237f566474f01dbb7ea4054b64582c689699d3 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sun, 16 Oct 2022 17:21:23 +0200 Subject: [PATCH] watch: enable sourcemaps and disable minify --- scripts/build/build.mjs | 3 +-- scripts/build/buildWeb.mjs | 2 -- scripts/build/common.mjs | 9 ++++----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/scripts/build/build.mjs b/scripts/build/build.mjs index 281246af..73d220d7 100755 --- a/scripts/build/build.mjs +++ b/scripts/build/build.mjs @@ -10,6 +10,7 @@ const nodeCommonOpts = { format: "cjs", platform: "node", target: ["esnext"], + minify: true, sourcemap: "linked", plugins: [makeAllPackagesExternalPlugin], }; @@ -38,8 +39,6 @@ await Promise.all([ globPlugins, gitHashPlugin ], - sourcemap: "inline", - minify: true, define: { IS_WEB: "false" } diff --git a/scripts/build/buildWeb.mjs b/scripts/build/buildWeb.mjs index dd8cb5df..62993988 100644 --- a/scripts/build/buildWeb.mjs +++ b/scripts/build/buildWeb.mjs @@ -15,8 +15,6 @@ const commonOptions = { entryPoints: ["browser/Vencord.ts"], globalName: "Vencord", format: "iife", - minify: true, - sourcemap: false, external: ["plugins", "git-hash"], plugins: [ globPlugins, diff --git a/scripts/build/common.mjs b/scripts/build/common.mjs index d9b2878d..59153a65 100644 --- a/scripts/build/common.mjs +++ b/scripts/build/common.mjs @@ -2,10 +2,7 @@ import { execSync } from "child_process"; import esbuild from "esbuild"; import { readdir } from "fs/promises"; -/** - * @type {esbuild.WatchMode|false} - */ -export const watch = process.argv.includes("--watch"); +const watch = process.argv.includes("--watch"); /** * @type {esbuild.BuildOptions} @@ -13,7 +10,9 @@ export const watch = process.argv.includes("--watch"); export const commonOpts = { logLevel: "info", bundle: true, - watch + watch, + minify: !watch, + sourcemap: watch ? "inline" : "" }; // https://github.com/evanw/esbuild/issues/619#issuecomment-751995294