diff options
Diffstat (limited to 'scripts/build/build.mjs')
-rwxr-xr-x | scripts/build/build.mjs | 15 |
1 files changed, 9 insertions, 6 deletions
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 |