-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild.mjs
More file actions
36 lines (31 loc) · 966 Bytes
/
build.mjs
File metadata and controls
36 lines (31 loc) · 966 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
29
30
31
32
33
34
35
36
import esbuild from "esbuild";
const commonConfig = {
entryPoints: ["src/index.js"], // Your main JavaScript file that imports the others
bundle: true, // Bundle all dependencies into a single file
format: "esm", // Use ES modules format
sourcemap: true, // Generate source maps for debugging
target: ["es2020"], // Target browser compatibility
};
async function build() {
try {
// Production (minified) build
await esbuild.build({
...commonConfig,
outfile: "dist/jsjiit.min.esm.js",
minify: true,
});
console.log("✅ Production build complete");
// Development (unminified) build
await esbuild.build({
...commonConfig,
outfile: "dist/jsjiit.esm.js",
minify: false,
});
console.log("✅ Development build complete");
console.log("🎉 All builds completed successfully!");
} catch (error) {
console.error("❌ Build failed:", error);
process.exit(1);
}
}
build();