Just found out esbuild has a logLevel prop

This commit is contained in:
Vendicated 2022-09-16 22:40:22 +02:00
parent 8cc43cdc7c
commit 5f62d2d3ec
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3
2 changed files with 5 additions and 14 deletions

View file

@ -7,12 +7,7 @@ import { performance } from "perf_hooks";
/** /**
* @type {esbuild.WatchMode|false} * @type {esbuild.WatchMode|false}
*/ */
const watch = process.argv.includes("--watch") ? { const watch = process.argv.includes("--watch");
onRebuild: (err) => {
if (err) console.error("Build Error", err.message);
else console.log("Rebuilt!");
}
} : false;
// https://github.com/evanw/esbuild/issues/619#issuecomment-751995294 // https://github.com/evanw/esbuild/issues/619#issuecomment-751995294
/** /**
@ -77,9 +72,9 @@ const gitHashPlugin = {
} }
}; };
const begin = performance.now();
await Promise.all([ await Promise.all([
esbuild.build({ esbuild.build({
logLevel: "info",
entryPoints: ["src/preload.ts"], entryPoints: ["src/preload.ts"],
outfile: "dist/preload.js", outfile: "dist/preload.js",
format: "cjs", format: "cjs",
@ -91,6 +86,7 @@ await Promise.all([
watch watch
}), }),
esbuild.build({ esbuild.build({
logLevel: "info",
entryPoints: ["src/patcher.ts"], entryPoints: ["src/patcher.ts"],
outfile: "dist/patcher.js", outfile: "dist/patcher.js",
bundle: true, bundle: true,
@ -103,6 +99,7 @@ await Promise.all([
watch watch
}), }),
esbuild.build({ esbuild.build({
logLevel: "info",
entryPoints: ["src/Vencord.ts"], entryPoints: ["src/Vencord.ts"],
outfile: "dist/renderer.js", outfile: "dist/renderer.js",
format: "iife", format: "iife",
@ -119,12 +116,7 @@ await Promise.all([
watch, watch,
minify: true, minify: true,
}) })
]).then(res => { ]).catch(err => {
const took = performance.now() - begin;
console.log(`Built in ${took.toFixed(2)}ms`);
}).catch(err => {
console.error("Build failed"); console.error("Build failed");
console.error(err.message); console.error(err.message);
}); });
if (watch) console.log("Watching...");

View file

@ -7,7 +7,6 @@ import { Button, ButtonProps, Flex, Switch, Forms, React } from "../webpack/comm
import ErrorBoundary from "./ErrorBoundary"; import ErrorBoundary from "./ErrorBoundary";
import { startPlugin } from "../plugins"; import { startPlugin } from "../plugins";
import { stopPlugin } from '../plugins/index'; import { stopPlugin } from '../plugins/index';
import { openModal, closeModal } from '../utils/modal';
export default ErrorBoundary.wrap(function Settings(props) { export default ErrorBoundary.wrap(function Settings(props) {
const [settingsDir, , settingsDirPending] = useAwaiter(() => VencordNative.ipc.invoke<string>(IpcEvents.GET_SETTINGS_DIR), "Loading..."); const [settingsDir, , settingsDirPending] = useAwaiter(() => VencordNative.ipc.invoke<string>(IpcEvents.GET_SETTINGS_DIR), "Loading...");