From 3c8084ec36b82fdf7ea89aaf6558197d9c070ca9 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 9 Nov 2022 19:26:39 +0100 Subject: Add VSCode debug config --- scripts/build/build.mjs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'scripts/build/build.mjs') diff --git a/scripts/build/build.mjs b/scripts/build/build.mjs index 3d43269..70a05cf 100755 --- a/scripts/build/build.mjs +++ b/scripts/build/build.mjs @@ -44,20 +44,23 @@ const nodeCommonOpts = { define: defines, }; +const sourceMapFooter = s => watch ? "" : `//# sourceMappingURL=vencord://${s}.js.map`; +const sourcemap = watch ? "inline" : "external"; + await Promise.all([ esbuild.build({ ...nodeCommonOpts, entryPoints: ["src/preload.ts"], outfile: "dist/preload.js", - footer: { js: "//# sourceURL=VencordPreload\n//# sourceMappingURL=vencord://preload.js.map" }, - sourcemap: "external", + footer: { js: "//# sourceURL=VencordPreload\n" + sourceMapFooter("preload") }, + sourcemap, }), esbuild.build({ ...nodeCommonOpts, entryPoints: ["src/patcher.ts"], outfile: "dist/patcher.js", - footer: { js: "//# sourceURL=VencordPatcher\n//# sourceMappingURL=vencord://patcher.js.map" }, - sourcemap: "external", + footer: { js: "//# sourceURL=VencordPatcher\n" + sourceMapFooter("patcher") }, + sourcemap, }), esbuild.build({ ...commonOpts, @@ -65,9 +68,9 @@ await Promise.all([ outfile: "dist/renderer.js", format: "iife", target: ["esnext"], - footer: { js: "//# sourceURL=VencordRenderer\n//# sourceMappingURL=vencord://renderer.js.map" }, + footer: { js: "//# sourceURL=VencordRenderer\n" + sourceMapFooter("renderer") }, globalName: "Vencord", - sourcemap: "external", + sourcemap, plugins: [ globPlugins, ...commonOpts.plugins -- cgit