mirror of
https://github.com/RobinRMC/VencordPlus.git
synced 2025-05-11 18:05:39 +02:00
Optimise Web via treeshaking, cleanup build scripts
This commit is contained in:
parent
845088ec02
commit
01ae0983b3
14 changed files with 261 additions and 269 deletions
53
scripts/build/build.mjs
Executable file
53
scripts/build/build.mjs
Executable file
|
@ -0,0 +1,53 @@
|
|||
#!/usr/bin/node
|
||||
import esbuild from "esbuild";
|
||||
import { commonOpts, gitHashPlugin, globPlugins, makeAllPackagesExternalPlugin } from "./common.mjs";
|
||||
|
||||
/**
|
||||
* @type {esbuild.BuildOptions}
|
||||
*/
|
||||
const nodeCommonOpts = {
|
||||
...commonOpts,
|
||||
format: "cjs",
|
||||
platform: "node",
|
||||
target: ["esnext"],
|
||||
sourcemap: "linked",
|
||||
plugins: [makeAllPackagesExternalPlugin],
|
||||
};
|
||||
|
||||
await Promise.all([
|
||||
esbuild.build({
|
||||
...nodeCommonOpts,
|
||||
entryPoints: ["src/preload.ts"],
|
||||
outfile: "dist/preload.js",
|
||||
}),
|
||||
esbuild.build({
|
||||
...nodeCommonOpts,
|
||||
entryPoints: ["src/patcher.ts"],
|
||||
outfile: "dist/patcher.js",
|
||||
}),
|
||||
esbuild.build({
|
||||
...commonOpts,
|
||||
entryPoints: ["src/Vencord.ts"],
|
||||
outfile: "dist/renderer.js",
|
||||
format: "iife",
|
||||
target: ["esnext"],
|
||||
footer: { js: "//# sourceURL=VencordRenderer" },
|
||||
globalName: "Vencord",
|
||||
external: ["plugins", "git-hash"],
|
||||
plugins: [
|
||||
globPlugins,
|
||||
gitHashPlugin
|
||||
],
|
||||
sourcemap: "inline",
|
||||
minify: true,
|
||||
define: {
|
||||
IS_WEB: "false"
|
||||
}
|
||||
}),
|
||||
]).catch(err => {
|
||||
console.error("Build failed");
|
||||
console.error(err.message);
|
||||
// make ci fail
|
||||
if (!watch)
|
||||
process.exitCode = 1;
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue