2024-08-27 07:15:53 +02:00
|
|
|
const esbuild = require("esbuild");
|
2025-01-02 13:44:43 +01:00
|
|
|
const isDev = process.env.NODE_ENV == "development";
|
2024-08-27 07:15:53 +02:00
|
|
|
|
2025-01-02 13:44:43 +01:00
|
|
|
if (!isDev) {
|
|
|
|
esbuild
|
|
|
|
.build({
|
|
|
|
entryPoints: ["src/index.js"],
|
|
|
|
bundle: true,
|
|
|
|
outfile: "dist/mod.js", // Mod output file
|
|
|
|
platform: "node",
|
|
|
|
target: "es2017"
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
throw err;
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
esbuild
|
|
|
|
.context({
|
|
|
|
entryPoints: ["src/index.js"],
|
|
|
|
bundle: true,
|
|
|
|
outfile: "svrjs/mods/mod.js", // Mod output file
|
|
|
|
platform: "node",
|
|
|
|
target: "es2017"
|
|
|
|
})
|
|
|
|
.then((ctx) => {
|
|
|
|
ctx
|
|
|
|
.watch()
|
|
|
|
.then(() => {
|
|
|
|
console.log("Watching for changes in SVR.JS mod source code...");
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
throw err;
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
throw err;
|
|
|
|
});
|
|
|
|
}
|