feat: add commithash to error screen

This commit is contained in:
Percs 2024-10-11 17:35:06 -05:00
parent 0da63dc296
commit 9ea9863ced
2 changed files with 24 additions and 14 deletions

View file

@ -3,6 +3,7 @@ import { rspack } from "@rspack/core";
import { RsdoctorRspackPlugin } from "@rsdoctor/rspack-plugin";
import { readFile } from "node:fs/promises";
import { execSync } from "node:child_process";
import { join } from "path";
import { fileURLToPath } from "url";
const __dirname = fileURLToPath(new URL(".", import.meta.url));
@ -66,6 +67,14 @@ export default defineConfig({
new rspack.DefinePlugin({
VERSION: JSON.stringify(packagemeta.version),
}),
new rspack.DefinePlugin({
COMMITHASH: JSON.stringify(
execSync("git rev-parse HEAD", { encoding: "utf-8" }).replace(
/\r?\n|\r/g,
""
)
),
}),
process.env.DEBUG === "true"
? new RsdoctorRspackPlugin({
supports: {