Files

22 lines
724 B
JavaScript

// Сборка WebUI (React + Ariakit) в dist/web: один JS-бандл и CSS, index.html рядом.
import { build } from "esbuild";
import { cpSync, mkdirSync, rmSync } from "node:fs";
rmSync("dist/web", { recursive: true, force: true });
mkdirSync("dist/web/assets", { recursive: true });
await build({
entryPoints: ["web/src/main.tsx"],
bundle: true,
minify: true,
sourcemap: true,
target: "es2022",
format: "esm",
jsx: "automatic",
outfile: "dist/web/assets/app.js",
loader: { ".css": "css" },
define: { "process.env.NODE_ENV": '"production"' },
});
cpSync("web/index.html", "dist/web/index.html");
cpSync("web/src/styles.css", "dist/web/assets/styles.css");
console.log("web собран");