-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
28 lines (23 loc) · 835 Bytes
/
Copy pathbuild.js
File metadata and controls
28 lines (23 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const esbuild = require("esbuild");
const fs = require("fs");
const path = require("path");
const dist = path.join(__dirname, "dist");
if (!fs.existsSync(dist)) fs.mkdirSync(dist);
esbuild.buildSync({
entryPoints: ["src/index.jsx"],
bundle: true,
minify: true,
platform: "browser",
target: "es2017",
outfile: "dist/bundle.js",
jsx: "automatic",
define: { "process.env.NODE_ENV": '"production"' },
});
fs.copyFileSync("public/index.html", "dist/index.html");
const logosSrc = path.join(__dirname, "public/logos");
const logosDist = path.join(dist, "logos");
if (!fs.existsSync(logosDist)) fs.mkdirSync(logosDist);
fs.readdirSync(logosSrc).forEach(f => {
fs.copyFileSync(path.join(logosSrc, f), path.join(logosDist, f));
});
console.log("✓ Build complete → dist/");