diff --git a/.gitignore b/.gitignore index b4b0762..7a7b677 100644 --- a/.gitignore +++ b/.gitignore @@ -140,3 +140,4 @@ src/webpage/translations/langs.js package-lock.json pnpm-lock.yaml +build.js diff --git a/buildnode.js b/buildnode.js new file mode 100644 index 0000000..a2f37dd --- /dev/null +++ b/buildnode.js @@ -0,0 +1,16 @@ +import * as swc from "@swc/core"; +import path from "node:path"; +import {fileURLToPath} from "node:url"; +import {promises as fs} from "fs"; +import child_process from "child_process"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const mod = await swc.transformFile(path.join(__dirname, "build.ts"), { + minify: true, + sourceMaps: true, + isModule: true, +}); + +await fs.writeFile(path.join(__dirname, "build.js"), mod.code); diff --git a/package.json b/package.json index 79d846f..092f3e3 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "type": "module", "scripts": { "bunBuild": "bun build.ts", - "build": "node --experimental-strip-types build.ts", + "build": "node buildnode.js && node build.js", "start": "node dist/index.js" }, "author": "MathMan05",